Search
typecheckCode
typecheckCode
Type check a code file and return the diagnostics.
framer.typecheckCode(fileName: string, content: string, compilerOptions?: ts.server.protocol.CompilerOptions, sessionId?: string): Promise<TypecheckDiagnostic[]
Parameters
fileName:string– The name of the code file, must include the extension. Use*.tsxfor TSX files, otherwise the React JSX syntax will be rejected.content:string– The content of the code file.compilerOptions:ts.server.protocol.CompilerOptions(optional) – Optional compiler options to override the default compiler options for type checking.sessionId:string(optional) – Optional session ID. Pass it when repeatedly type checking the same file. If not provided, a new session will be created for each type check, which is slow.
Returns
Promise<TypecheckDiagnostic[]>