From 5d585f6b8a908e22fdde0fedac6d7262a63bb282 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 27 Jan 2023 10:27:01 -0800 Subject: [PATCH 1/6] Skip JSDoc in .ts files Just an experiment for now. Current test failures: - all fourslash tests of jsdoc fail; the parser should produce jsdoc for tsserver. - Spurious unused-type errors because `@link` isn't parsed and treated as a usage. - ohhh no, `@this` is mistakenly interpreted in .ts files: thisInFunctionCall. --- src/compiler/parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b448910799401..f871763393f52 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1759,7 +1759,7 @@ namespace Parser { } function withJSDoc(node: T, hasJSDoc: boolean): T { - return hasJSDoc ? addJSDocComment(node) : node; + return hasJSDoc && (node.flags & NodeFlags.JavaScriptFile) ? addJSDocComment(node) : node; } let hasDeprecatedTag = false; From 88e04345513f5420402e7a87bc9bc1e33f7d9b6f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 27 Jan 2023 13:13:53 -0800 Subject: [PATCH 2/6] Don't skip in tsserver or if comment contains @link/@see --- src/compiler/checker.ts | 1 + src/compiler/parser.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4765c1aa33402..7ea4de6a0fdcc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -44038,6 +44038,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function checkSourceElementWorker(node: Node): void { if (canHaveJSDoc(node)) { + // TODO: This part still needs to be disabled for tsc in a lazy-jsdoc-parsing build forEach(node.jsDoc, ({ comment, tags }) => { checkJSDocCommentWorker(comment); forEach(tags, tag => { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f871763393f52..3919ea9200033 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1413,6 +1413,7 @@ namespace Parser { let IdentifierConstructor: new (kind: SyntaxKind.Identifier, pos: number, end: number) => Identifier; let PrivateIdentifierConstructor: new (kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) => PrivateIdentifier; let SourceFileConstructor: new (kind: SyntaxKind.SourceFile, pos: number, end: number) => SourceFile; + let isInTsserver = true; function countNode(node: Node) { nodeCount++; @@ -1659,6 +1660,7 @@ namespace Parser { IdentifierConstructor = objectAllocator.getIdentifierConstructor(); PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor(); SourceFileConstructor = objectAllocator.getSourceFileConstructor(); + isInTsserver = !!(new NodeConstructor(0, 0, 0).constructor); fileName = normalizePath(_fileName); sourceText = _sourceText; @@ -1759,13 +1761,20 @@ namespace Parser { } function withJSDoc(node: T, hasJSDoc: boolean): T { - return hasJSDoc && (node.flags & NodeFlags.JavaScriptFile) ? addJSDocComment(node) : node; + return hasJSDoc ? addJSDocComment(node) : node; + } + + function shouldCheckJSDoc(node: T, comment: ts.CommentRange) { + if (isInTsserver) return true; + if (node.flags & NodeFlags.JavaScriptFile) return true; + const i = sourceText.indexOf("@link", comment.pos) + if (comment.pos < i && i < comment.end) return true; } let hasDeprecatedTag = false; function addJSDocComment(node: T): T { Debug.assert(!node.jsDoc); // Should only be called once per node - const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), comment => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos)); + const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), comment => shouldCheckJSDoc(node, comment) && JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos)); if (jsDoc.length) node.jsDoc = jsDoc; if (hasDeprecatedTag) { hasDeprecatedTag = false; From 3d5d2a671a1e58cab5d8889f00b1652ab41084aa Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 27 Jan 2023 13:16:05 -0800 Subject: [PATCH 3/6] oops, really check @see also delete comment in checker, that's for a different experiment --- src/compiler/checker.ts | 1 - src/compiler/parser.ts | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7ea4de6a0fdcc..4765c1aa33402 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -44038,7 +44038,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function checkSourceElementWorker(node: Node): void { if (canHaveJSDoc(node)) { - // TODO: This part still needs to be disabled for tsc in a lazy-jsdoc-parsing build forEach(node.jsDoc, ({ comment, tags }) => { checkJSDocCommentWorker(comment); forEach(tags, tag => { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 3919ea9200033..68b03a612d2d6 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1767,8 +1767,10 @@ namespace Parser { function shouldCheckJSDoc(node: T, comment: ts.CommentRange) { if (isInTsserver) return true; if (node.flags & NodeFlags.JavaScriptFile) return true; - const i = sourceText.indexOf("@link", comment.pos) - if (comment.pos < i && i < comment.end) return true; + const link = sourceText.indexOf("@link", comment.pos); + const see = sourceText.indexOf("@see", comment.pos); + if (comment.pos < link && link < comment.end) return true; + if (comment.pos < see && see < comment.end) return true; } let hasDeprecatedTag = false; From ebcbd11d35312b8537a7b496c81f5746f02504a6 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 27 Jan 2023 16:51:56 -0800 Subject: [PATCH 4/6] tweak is-in-tsc test --- src/compiler/parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 68b03a612d2d6..b1060e713feef 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1660,7 +1660,7 @@ namespace Parser { IdentifierConstructor = objectAllocator.getIdentifierConstructor(); PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor(); SourceFileConstructor = objectAllocator.getSourceFileConstructor(); - isInTsserver = !!(new NodeConstructor(0, 0, 0).constructor); + isInTsserver = (new NodeConstructor(0, 0, 0).constructor.name !== "Node"); fileName = normalizePath(_fileName); sourceText = _sourceText; From 2842d0ceccdc691c2de5bd6c1f136ce4c45a6c6e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 1 Feb 2023 10:33:09 -0800 Subject: [PATCH 5/6] Better/faster checks for shouldParseJSDoc 1. Set a global boolean when invoked from tsc. 2. Use a regex with sourceText.slice to check for @see/@link. --- src/compiler/parser.ts | 15 ++++++--------- src/tsc/tsc.ts | 3 +++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b1060e713feef..6cc6baae1e0a9 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1413,7 +1413,6 @@ namespace Parser { let IdentifierConstructor: new (kind: SyntaxKind.Identifier, pos: number, end: number) => Identifier; let PrivateIdentifierConstructor: new (kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) => PrivateIdentifier; let SourceFileConstructor: new (kind: SyntaxKind.SourceFile, pos: number, end: number) => SourceFile; - let isInTsserver = true; function countNode(node: Node) { nodeCount++; @@ -1660,10 +1659,10 @@ namespace Parser { IdentifierConstructor = objectAllocator.getIdentifierConstructor(); PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor(); SourceFileConstructor = objectAllocator.getSourceFileConstructor(); - isInTsserver = (new NodeConstructor(0, 0, 0).constructor.name !== "Node"); fileName = normalizePath(_fileName); sourceText = _sourceText; + languageVersion = _languageVersion; syntaxCursor = _syntaxCursor; scriptKind = _scriptKind; @@ -1764,19 +1763,17 @@ namespace Parser { return hasJSDoc ? addJSDocComment(node) : node; } - function shouldCheckJSDoc(node: T, comment: ts.CommentRange) { - if (isInTsserver) return true; + const seeLink = /@(?:see|link)/; + function shouldParseJSDoc(node: T, comment: ts.CommentRange) { + if (!(globalThis as any).isTSC) return true; if (node.flags & NodeFlags.JavaScriptFile) return true; - const link = sourceText.indexOf("@link", comment.pos); - const see = sourceText.indexOf("@see", comment.pos); - if (comment.pos < link && link < comment.end) return true; - if (comment.pos < see && see < comment.end) return true; + if (seeLink.test(sourceText.slice(comment.pos, comment.end))) return true; } let hasDeprecatedTag = false; function addJSDocComment(node: T): T { Debug.assert(!node.jsDoc); // Should only be called once per node - const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), comment => shouldCheckJSDoc(node, comment) && JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos)); + const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), comment => shouldParseJSDoc(node, comment) && JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos)); if (jsDoc.length) node.jsDoc = jsDoc; if (hasDeprecatedTag) { hasDeprecatedTag = false; diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index ce8b356b685d9..057798b679051 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -20,5 +20,8 @@ if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnviron if (ts.sys.setBlocking) { ts.sys.setBlocking(); } +declare var console: any; +console.log("I am over here") +;(globalThis as any)["isTSC"] = true; ts.executeCommandLine(ts.sys, ts.noop, ts.sys.args); From 38d0e2c8219083aa58954ce43caa1f0257a92ebe Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 3 Feb 2023 13:01:29 -0800 Subject: [PATCH 6/6] Add command-line option skipJSDoc --- src/compiler/commandLineParser.ts | 9 ++++++- src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/parser.ts | 35 ++++++++++++++++------------ src/compiler/program.ts | 2 +- src/compiler/tsbuildPublic.ts | 1 + src/compiler/types.ts | 1 + src/tsc/tsc.ts | 4 +--- 7 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 629063de29808..4d942744ac481 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -500,6 +500,13 @@ export const commonOptionsWithBuild: CommandLineOption[] = [ description: Diagnostics.Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit, defaultValueDescription: Diagnostics.Platform_specific }, + { + name: "skipJSDoc", + type: "boolean", + category: Diagnostics.Completeness, + description: Diagnostics.Skip_parsing_JSDoc_comments_in_ts_files, + defaultValueDescription: false, + }, ]; /** @internal */ @@ -803,7 +810,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ type: "boolean", // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here // The value of each strictFlag depends on own strictFlag value or this and never accessed directly. - // But we need to store `strict` in builf info, even though it won't be examined directly, so that the + // But we need to store `strict` in build info, even though it won't be examined directly, so that the // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly affectsBuildInfo: true, showInSimplifiedHelpView: true, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 838c4fd0afc3f..52baa7d932f25 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -5967,6 +5967,10 @@ "category": "Message", "code": 6695 }, + "Skip parsing JSDoc comments in .ts files": { + "category": "Message", + "code": 6696 + }, "Check that the arguments for 'bind', 'call', and 'apply' methods match the original function.": { "category": "Message", "code": 6697 diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 8d6cde5f578e6..34e3210f8948a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1309,13 +1309,17 @@ export interface CreateSourceFileOptions { setExternalModuleIndicator?: (file: SourceFile) => void; /** @internal */ packageJsonLocations?: readonly string[]; /** @internal */ packageJsonScope?: PackageJsonInfo; + /** + * Skip parsing JSDoc in .ts files to speed up parsing. + */ + skipJSDoc?: boolean; } function setExternalModuleIndicator(sourceFile: SourceFile) { sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile); } -export function createSourceFile(fileName: string, sourceText: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, setParentNodes = false, scriptKind?: ScriptKind): SourceFile { +export function createSourceFile(fileName: string, sourceText: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, setParentNodes = false, scriptKind?: ScriptKind, skipJSDoc = false): SourceFile { tracing?.push(tracing.Phase.Parse, "createSourceFile", { path: fileName }, /*separateBeginAndEnd*/ true); performance.mark("beforeParse"); let result: SourceFile; @@ -1324,17 +1328,17 @@ export function createSourceFile(fileName: string, sourceText: string, languageV const { languageVersion, setExternalModuleIndicator: overrideSetExternalModuleIndicator, - impliedNodeFormat: format + impliedNodeFormat: format, } = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : ({ languageVersion: languageVersionOrOptions } as CreateSourceFileOptions); if (languageVersion === ScriptTarget.JSON) { - result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, ScriptKind.JSON, noop); + result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, skipJSDoc, ScriptKind.JSON, noop); } else { const setIndicator = format === undefined ? overrideSetExternalModuleIndicator : (file: SourceFile) => { file.impliedNodeFormat = format; return (overrideSetExternalModuleIndicator || setExternalModuleIndicator)(file); }; - result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind, setIndicator); + result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, skipJSDoc, scriptKind, setIndicator); } perfLogger.logStopParseSourceFile(); @@ -1436,6 +1440,7 @@ namespace Parser { let sourceText: string; let languageVersion: ScriptTarget; let scriptKind: ScriptKind; + let skipJSDoc: boolean; let languageVariant: LanguageVariant; let parseDiagnostics: DiagnosticWithDetachedLocation[]; let jsDocDiagnostics: DiagnosticWithDetachedLocation[]; @@ -1530,7 +1535,7 @@ namespace Parser { // attached to the EOF token. let parseErrorBeforeNextFinishedNode = false; - export function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: IncrementalParser.SyntaxCursor | undefined, setParentNodes = false, scriptKind?: ScriptKind, setExternalModuleIndicatorOverride?: (file: SourceFile) => void): SourceFile { + export function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: IncrementalParser.SyntaxCursor | undefined, setParentNodes = false, skipJSDoc = false, scriptKind?: ScriptKind, setExternalModuleIndicatorOverride?: (file: SourceFile) => void): SourceFile { scriptKind = ensureScriptKind(fileName, scriptKind); if (scriptKind === ScriptKind.JSON) { const result = parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes); @@ -1544,7 +1549,7 @@ namespace Parser { return result; } - initializeState(fileName, sourceText, languageVersion, syntaxCursor, scriptKind); + initializeState(fileName, sourceText, languageVersion, syntaxCursor, scriptKind, skipJSDoc); const result = parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicatorOverride || setExternalModuleIndicator); @@ -1555,7 +1560,7 @@ namespace Parser { export function parseIsolatedEntityName(content: string, languageVersion: ScriptTarget): EntityName | undefined { // Choice of `isDeclarationFile` should be arbitrary - initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, ScriptKind.JS); + initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, ScriptKind.JS, false); // Prime the scanner. nextToken(); const entityName = parseEntityName(/*allowReservedWords*/ true); @@ -1565,7 +1570,7 @@ namespace Parser { } export function parseJsonText(fileName: string, sourceText: string, languageVersion: ScriptTarget = ScriptTarget.ES2015, syntaxCursor?: IncrementalParser.SyntaxCursor, setParentNodes = false): JsonSourceFile { - initializeState(fileName, sourceText, languageVersion, syntaxCursor, ScriptKind.JSON); + initializeState(fileName, sourceText, languageVersion, syntaxCursor, ScriptKind.JSON, false); sourceFlags = contextFlags; // Prime the scanner. @@ -1653,7 +1658,7 @@ namespace Parser { return result; } - function initializeState(_fileName: string, _sourceText: string, _languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor | undefined, _scriptKind: ScriptKind) { + function initializeState(_fileName: string, _sourceText: string, _languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor | undefined, _scriptKind: ScriptKind, _skipJSDoc: boolean) { NodeConstructor = objectAllocator.getNodeConstructor(); TokenConstructor = objectAllocator.getTokenConstructor(); IdentifierConstructor = objectAllocator.getIdentifierConstructor(); @@ -1662,10 +1667,10 @@ namespace Parser { fileName = normalizePath(_fileName); sourceText = _sourceText; - languageVersion = _languageVersion; syntaxCursor = _syntaxCursor; scriptKind = _scriptKind; + skipJSDoc = _skipJSDoc; languageVariant = getLanguageVariant(_scriptKind); parseDiagnostics = []; @@ -1765,7 +1770,7 @@ namespace Parser { const seeLink = /@(?:see|link)/; function shouldParseJSDoc(node: T, comment: ts.CommentRange) { - if (!(globalThis as any).isTSC) return true; + if (!skipJSDoc) return true; if (node.flags & NodeFlags.JavaScriptFile) return true; if (seeLink.test(sourceText.slice(comment.pos, comment.end))) return true; } @@ -8417,7 +8422,7 @@ namespace Parser { export namespace JSDocParser { export function parseJSDocTypeExpressionForTests(content: string, start: number | undefined, length: number | undefined): { jsDocTypeExpression: JSDocTypeExpression, diagnostics: Diagnostic[] } | undefined { - initializeState("file.js", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS); + initializeState("file.js", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS, false); scanner.setText(content, start, length); currentToken = scanner.scan(); const jsDocTypeExpression = parseJSDocTypeExpression(); @@ -8467,7 +8472,7 @@ namespace Parser { } export function parseIsolatedJSDocComment(content: string, start: number | undefined, length: number | undefined): { jsDoc: JSDoc, diagnostics: Diagnostic[] } | undefined { - initializeState("", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS); + initializeState("", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS, false); const jsDoc = doInsideOfContext(NodeFlags.JSDoc, () => parseJSDocCommentWorker(start, length)); const sourceFile = { languageVariant: LanguageVariant.Standard, text: content } as SourceFile; @@ -9501,7 +9506,7 @@ namespace IncrementalParser { if (sourceFile.statements.length === 0) { // If we don't have any statements in the current source file, then there's no real // way to incrementally parse. So just do a full parse instead. - return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator); + return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, /*skipJSDoc*/ false, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator); } // Make sure we're not trying to incrementally update a source file more than once. Once @@ -9565,7 +9570,7 @@ namespace IncrementalParser { // inconsistent tree. Setting the parents on the new tree should be very fast. We // will immediately bail out of walking any subtrees when we can see that their parents // are already correct. - const result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator); + const result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, /*skipJSDoc*/ false, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator); result.commentDirectives = getNewCommentDirectives( sourceFile.commentDirectives, result.commentDirectives, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 766d0292a42db..5becea0d2d5e0 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -407,7 +407,7 @@ export function createGetSourceFile( } text = ""; } - return text !== undefined ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : undefined; + return text !== undefined ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes, /*scriptKind*/ undefined, getCompilerOptions().skipJSDoc) : undefined; }; } diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index 572306483c438..56c33a444f909 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -158,6 +158,7 @@ export interface BuildOptions { /** @internal */ locale?: string; /** @internal */ generateCpuProfile?: string; /** @internal */ generateTrace?: string; + skipJSDoc?: boolean; [option: string]: CompilerOptionsValue | undefined; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 87a72ea860f3b..9c908785e893b 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7095,6 +7095,7 @@ export interface CompilerOptions { resolvePackageJsonImports?: boolean; rootDir?: string; rootDirs?: string[]; + skipJSDoc?: boolean; skipLibCheck?: boolean; skipDefaultLibCheck?: boolean; sourceMap?: boolean; diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 057798b679051..7e557ae9dd06d 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -20,8 +20,6 @@ if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnviron if (ts.sys.setBlocking) { ts.sys.setBlocking(); } -declare var console: any; -console.log("I am over here") -;(globalThis as any)["isTSC"] = true; +ts.sys.args.push("--skipJSDoc"); ts.executeCommandLine(ts.sys, ts.noop, ts.sys.args);