Add comments
This commit is contained in:
parent
c246d07c60
commit
a1b42765d0
|
@ -15,7 +15,7 @@ export interface IReactZodWebPartProps {
|
|||
}
|
||||
|
||||
export default class ReactZodWebPart extends BaseClientSideWebPart<IReactZodWebPartProps> {
|
||||
private _sp: SPFI;
|
||||
private _sp!: SPFI;
|
||||
|
||||
public async render(): Promise<void> {
|
||||
let element: React.ReactElement;
|
||||
|
|
|
@ -7,6 +7,7 @@ const dateFormatter = new Intl.DateTimeFormat([], {
|
|||
weekday: "short",
|
||||
});
|
||||
|
||||
// Setup schema
|
||||
const FormResultSchema = z.object({
|
||||
Id: z.number(),
|
||||
Title: z.string(),
|
||||
|
@ -27,6 +28,7 @@ const FormResultSchema = z.object({
|
|||
});
|
||||
const FormResultsSchema = z.array(FormResultSchema);
|
||||
|
||||
// Generate type from schema
|
||||
type FormResultModel = z.infer<typeof FormResultSchema>;
|
||||
type FormResultsModel = z.infer<typeof FormResultsSchema>;
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ export default class SharePointHelper {
|
|||
"Contact/Title",
|
||||
"Email"
|
||||
)();
|
||||
|
||||
// Parse data into a fully typed object
|
||||
return FormResultsSchema.parse(items);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
"skipLibCheck": true,
|
||||
"outDir": "lib",
|
||||
"inlineSources": false,
|
||||
"strictNullChecks": false,
|
||||
"noUnusedLocals": false,
|
||||
"noImplicitAny": true,
|
||||
"strict": true,
|
||||
|
||||
"typeRoots": [
|
||||
"./node_modules/@types",
|
||||
|
|
Loading…
Reference in New Issue