Open yoshi-68 opened 1 year ago
@yoshi-68 Can you provide more details on your issue ? How did you use FromSchema
? What version ? etc.
experiencing same issue with generics:
Here is an example:
export class ApiSchema<IN extends JSONSchema, OUT extends JSONSchema> {
readonly path: string;
readonly requestSchema: IN;
readonly responseSchema: OUT;
readonly requestValidate;
constructor(path: string, requestSchema: IN, responseSchema: OUT) {
this.path = path;
this.requestSchema = requestSchema;
this.responseSchema = responseSchema;
this.requestValidate = ajv.compile(requestSchema);
}
buildPostApi(
handle: (requestBody: FromSchema<IN>, request: RequestEvent) => Promise<FromSchema<OUT>>
): (event: RequestEventAny) => Response | Promise<Response> {
...
}
}
@Seancheey this might be a bit old and maybe you've moved from it, but the docs in here helped me solve this: https://github.com/ThomasAribart/json-schema-to-ts/blob/main/documentation/FAQs/applying-from-schema-on-generics.md
They should be displayed more promptly!
Importing
FromSchema
slows VSCode's syntax check.