Fix diagnostic serialization crash (#47604)

* Add crashing test

* Fix unsafe cast to DiagnosticMessageChain
This commit is contained in:
Andrew Branch
2022-01-26 10:41:47 -08:00
committed by GitHub
parent 3206df8e6d
commit c191e7c942
4 changed files with 226 additions and 1 deletions

View File

@@ -418,5 +418,36 @@ declare global {
incrementalScenarios: noChangeOnlyRuns,
baselinePrograms: true
});
verifyTscSerializedIncrementalEdits({
scenario: "incremental",
subScenario: "serializing error chains",
commandLineArgs: ["-p", `src/project`],
fs: () => loadProjectFromFiles({
"/src/project/tsconfig.json": JSON.stringify({
compilerOptions: {
incremental: true,
strict: true,
jsx: "react",
module: "esnext",
},
}),
"/src/project/index.tsx": Utils.dedent`
declare namespace JSX {
interface ElementChildrenAttribute { children: {}; }
interface IntrinsicElements { div: {} }
}
declare var React: any;
declare function Component(props: never): any;
declare function Component(props: { children?: number }): any;
(<Component>
<div />
<div />
</Component>)`
}, `\ninterface ReadonlyArray<T> { readonly length: number }`),
incrementalScenarios: noChangeOnlyRuns,
});
});
}