Add comments

This commit is contained in:
AriGunawan 2022-10-15 09:11:23 +10:00
parent c246d07c60
commit a1b42765d0
4 changed files with 6 additions and 2 deletions

View File

@ -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;

View File

@ -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>;

View File

@ -24,6 +24,8 @@ export default class SharePointHelper {
"Contact/Title",
"Email"
)();
// Parse data into a fully typed object
return FormResultsSchema.parse(items);
}
}

View File

@ -12,9 +12,9 @@
"skipLibCheck": true,
"outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noUnusedLocals": false,
"noImplicitAny": true,
"strict": true,
"typeRoots": [
"./node_modules/@types",