mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-12 23:36:28 -05:00
Set JSDocParsingMode.ParseForTypeErrors in compiler tests (#58917)
This commit is contained in:
@@ -381,6 +381,9 @@ export class CompilerHost implements ts.CompilerHost {
|
||||
}
|
||||
}
|
||||
|
||||
// Set ParseForTypeErrors like tsc.
|
||||
languageVersionOrOptions = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { languageVersion: languageVersionOrOptions };
|
||||
languageVersionOrOptions = { ...languageVersionOrOptions, jsDocParsingMode: ts.JSDocParsingMode.ParseForTypeErrors };
|
||||
const parsed = ts.createSourceFile(fileName, content, languageVersionOrOptions, this._setParentNodes || this.shouldAssertInvariants);
|
||||
if (this.shouldAssertInvariants) {
|
||||
Utils.assertInvariants(parsed, /*parent*/ undefined);
|
||||
|
||||
@@ -222,6 +222,9 @@ export namespace Compiler {
|
||||
const shouldAssertInvariants = !lightMode;
|
||||
|
||||
// Only set the parent nodes if we're asserting invariants. We don't need them otherwise.
|
||||
// Set ParseForTypeErrors like tsc.
|
||||
languageVersionOrOptions = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { languageVersion: languageVersionOrOptions };
|
||||
languageVersionOrOptions = { ...languageVersionOrOptions, jsDocParsingMode: ts.JSDocParsingMode.ParseForTypeErrors };
|
||||
const result = ts.createSourceFile(fileName, sourceText, languageVersionOrOptions, /*setParentNodes:*/ shouldAssertInvariants);
|
||||
|
||||
if (shouldAssertInvariants) {
|
||||
|
||||
Reference in New Issue
Block a user