diff --git a/.eslintrc.json b/.eslintrc.json index 2ea9622d72e9d..1711f8592ab18 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,7 +2,6 @@ "parser": "@typescript-eslint/parser", "parserOptions": { "warnOnUnsupportedTypeScriptVersion": false, - "ecmaVersion": 6, "sourceType": "module" }, "env": { @@ -27,6 +26,7 @@ "rules": { "@typescript-eslint/adjacent-overload-signatures": "error", "@typescript-eslint/array-type": "error", + "@typescript-eslint/no-array-constructor": "error", "brace-style": "off", "@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }], @@ -62,12 +62,14 @@ "@typescript-eslint/prefer-for-of": "error", "@typescript-eslint/prefer-function-type": "error", "@typescript-eslint/prefer-namespace-keyword": "error", + "@typescript-eslint/prefer-as-const": "error", "quotes": "off", "@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }], "semi": "off", "@typescript-eslint/semi": "error", + "@typescript-eslint/no-extra-semi": "error", "space-before-function-paren": "off", "@typescript-eslint/space-before-function-paren": ["error", { @@ -80,6 +82,8 @@ "@typescript-eslint/type-annotation-spacing": "error", "@typescript-eslint/unified-signatures": "error", + "@typescript-eslint/no-extra-non-null-assertion": "error", + // scripts/eslint/rules "local/object-literal-surrounding-space": "error", "local/no-type-assertion-whitespace": "error", @@ -143,6 +147,9 @@ "quote-props": ["error", "consistent-as-needed"], "space-in-parens": "error", "unicode-bom": ["error", "never"], - "use-isnan": "error" + "use-isnan": "error", + "no-prototype-builtins": "error", + "no-self-assign": "error", + "no-dupe-else-if": "error" } } diff --git a/scripts/word2md.ts b/scripts/word2md.ts index ed0338617d8be..472699156bb8b 100644 --- a/scripts/word2md.ts +++ b/scripts/word2md.ts @@ -185,7 +185,7 @@ function convertDocumentToMarkdown(doc: Word.Document): string { function setProperties(target: any, properties: any) { for (const name in properties) { - if (properties.hasOwnProperty(name)) { + if (Object.prototype.hasOwnProperty.call(properties, name)) { const value = properties[name]; if (typeof value === "object") { setProperties(target[name], value); diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 1e347f9d81e15..4c3eac092b45a 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -3044,7 +3044,7 @@ namespace ts { return; } const rootExpr = getLeftmostAccessExpression(node.left); - if (isIdentifier(rootExpr) && lookupSymbolForName(container, rootExpr.escapedText)!?.flags & SymbolFlags.Alias) { + if (isIdentifier(rootExpr) && lookupSymbolForName(container, rootExpr.escapedText)?.flags! & SymbolFlags.Alias) { return; } // Fix up parent pointers since we're going to use these nodes before we bind into them diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f992dd0ea458f..afac9b5a1ae85 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9219,7 +9219,7 @@ namespace ts { if (container && (container.kind === SyntaxKind.Constructor || isJSConstructor(container))) { return container as ConstructorDeclaration; } - }; + } } /** Create a synthetic property access flow node after the last statement of the file */ @@ -29892,7 +29892,7 @@ namespace ts { return !!s && getMinArgumentCount(s) >= 1 && isTypeAssignableTo(keyedType, getTypeAtPosition(s, 0)); } return false; - }; + } const suggestedMethod = isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 7ad3644970b6f..b3dcb04c777d9 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -3709,7 +3709,7 @@ namespace ts { export function convertCompilerOptionsForTelemetry(opts: CompilerOptions): CompilerOptions { const out: CompilerOptions = {}; for (const key in opts) { - if (opts.hasOwnProperty(key)) { + if (hasProperty(opts, key)) { const type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index d6edd94b3dc49..70893ceb29bc1 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -279,7 +279,7 @@ namespace ts { if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (hasProperty(func, "name")) { return (func as any).name; } else { @@ -625,7 +625,7 @@ namespace ts { ]; for (const ctor of nodeConstructors) { - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!hasProperty(ctor, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 9d7a2fce604d5..27b2b75e9c7f0 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -5639,7 +5639,7 @@ namespace ts { setOriginalNode(clone, node); for (const key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (hasProperty(clone, key) || !hasProperty(node, key)) { continue; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 85f13a159ca04..91b94fc57c0e7 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -744,7 +744,7 @@ namespace ts { return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - }; + } function forEachChildInUnionOrIntersectionType(node: UnionTypeNode | IntersectionTypeNode, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNodes(cbNode, cbNodes, node.types); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 412f307eae4bf..5b48d317db7df 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -503,7 +503,7 @@ namespace ts { /* @internal */ imports: SourceFile["imports"]; /* @internal */ moduleAugmentations: SourceFile["moduleAugmentations"]; impliedNodeFormat?: SourceFile["impliedNodeFormat"]; - }; + } /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index a54389fbb9474..1bb62f652241c 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -361,7 +361,7 @@ namespace ts { /* @internal */ export function computeLineStarts(text: string): number[] { - const result: number[] = new Array(); + const result: number[] = []; let pos = 0; let lineStart = 0; while (pos < text.length) { diff --git a/src/compiler/tracing.ts b/src/compiler/tracing.ts index 5c7037b7e5c53..54f378d61cc16 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -25,7 +25,7 @@ namespace ts { // eslint-disable-line local/one-namespace-per-file // The actual constraint is that JSON.stringify be able to serialize it without throwing. interface Args { [key: string]: string | number | boolean | null | undefined | Args | readonly (string | number | boolean | null | undefined | Args)[]; - }; + } /** Starts tracing for the given project. */ export function startTracing(tracingMode: Mode, traceDir: string, configFilePath?: string) { diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index d64c14b2e0b2c..e453b77a3bff2 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -218,9 +218,9 @@ namespace ts { } function reportNonlocalAugmentation(containingFile: SourceFile, parentSymbol: Symbol, symbol: Symbol) { - const primaryDeclaration = parentSymbol.declarations?.find(d => getSourceFileOfNode(d) === containingFile)!; + const primaryDeclaration = parentSymbol.declarations?.find(d => getSourceFileOfNode(d) === containingFile); const augmentingDeclarations = filter(symbol.declarations, d => getSourceFileOfNode(d) !== containingFile); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (const augmentations of augmentingDeclarations) { context.addDiagnostic(addRelatedInfo( createDiagnosticForNode(augmentations, Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index 0849c5921f29a..7c773f5bdc3c5 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -487,7 +487,7 @@ namespace ts { // TODO(rbuckton): Should be a `Set`, but that requires changing the code below that uses `mutateMapSkippingNewValues` const currentProjects = new Map( getBuildOrderFromAnyBuildOrder(buildOrder).map( - resolved => [toResolvedConfigFilePath(state, resolved), true as true]) + resolved => [toResolvedConfigFilePath(state, resolved), true as const]) ); const noopOnDelete = { onDeleteValue: noop }; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 792c7d1f5cb3c..cdc0db9407b34 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -563,7 +563,7 @@ namespace ts { interface ScriptTargetFeatures { [key: string]: { [key: string]: string[] | undefined }; - }; + } export function getScriptTargetFeatures(): ScriptTargetFeatures { return { @@ -5558,7 +5558,7 @@ namespace ts { export function isWatchSet(options: CompilerOptions) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && hasProperty(options, "watch"); } export function closeFileWatcher(watcher: FileWatcher) { diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index c8b959eb8f87c..c6e083e9d7e1a 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1121,7 +1121,7 @@ namespace ts { /* @internal */ export function isNodeArray(array: readonly T[]): array is NodeArray { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return hasProperty(array, "pos") && hasProperty(array, "end"); } // Literals diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index cb3ba0575a146..5a891ad05c580 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -431,7 +431,7 @@ namespace ts { function getHeader(sys: System, message: string) { const colors = createColors(sys); const header: string[] = []; - const terminalWidth = sys.getWidthOfTerminal?.() ?? 0;; + const terminalWidth = sys.getWidthOfTerminal?.() ?? 0; const tsIconLength = 5; const tsIconFirstLine = colors.blueBackground(padLeft("", tsIconLength)); diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 46d2bc242e772..72ceb827adf95 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -2737,7 +2737,7 @@ namespace FourSlash { const identifier = this.classificationToIdentifier(a.classificationType as number); const text = this.activeFile.content.slice(a.textSpan.start, a.textSpan.start + a.textSpan.length); replacement.push(` c2.semanticToken("${identifier}", "${text}"), `); - }; + } replacement.push(");"); throw new Error("You need to change the source code of fourslash test to use replaceWithSemanticClassifications"); diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 4112072d38835..52acb7d347eec 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1900,11 +1900,11 @@ namespace FourSlashInterface { }; export interface DiagnosticIgnoredInterpolations { template: string - }; + } export type RenameLocationOptions = FourSlash.Range | { readonly range: FourSlash.Range, readonly prefixText?: string, readonly suffixText?: string }; export interface RenameOptions { readonly findInStrings?: boolean; readonly findInComments?: boolean; readonly providePrefixAndSuffixTextForRename?: boolean; - }; + } } diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index 2786498d41e1f..87148c13492a7 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -335,7 +335,7 @@ namespace Harness { export function setCompilerOptionsFromHarnessSetting(settings: TestCaseParser.CompilerSettings, options: ts.CompilerOptions & HarnessOptions): void { for (const name in settings) { - if (settings.hasOwnProperty(name)) { + if (ts.hasProperty(settings, name)) { const value = settings[name]; if (value === undefined) { throw new Error(`Cannot have undefined value for compiler option '${name}'.`); @@ -1496,7 +1496,7 @@ namespace Harness { export function getConfigNameFromFileName(filename: string): "tsconfig.json" | "jsconfig.json" | undefined { const flc = ts.getBaseFileName(filename).toLowerCase(); - return ts.find(["tsconfig.json" as "tsconfig.json", "jsconfig.json" as "jsconfig.json"], x => x === flc); + return ts.find(["tsconfig.json" as const, "jsconfig.json" as const], x => x === flc); } if (Error) (Error as any).stackTraceLimit = 100; diff --git a/src/harness/harnessUtils.ts b/src/harness/harnessUtils.ts index 97da7e0e3ec99..5ac968035346d 100644 --- a/src/harness/harnessUtils.ts +++ b/src/harness/harnessUtils.ts @@ -314,7 +314,7 @@ namespace Utils { function findChildName(parent: any, child: any) { for (const name in parent) { - if (parent.hasOwnProperty(name) && parent[name] === child) { + if (ts.hasProperty(parent, name) && parent[name] === child) { return name; } } diff --git a/src/harness/vfsUtil.ts b/src/harness/vfsUtil.ts index 63a3d6963d55e..f102bb0ddb63a 100644 --- a/src/harness/vfsUtil.ts +++ b/src/harness/vfsUtil.ts @@ -916,7 +916,6 @@ namespace vfs { if (this._shadowRoot) { this._copyShadowLinks(this._shadowRoot._getRootLinks(), this._lazy.links); } - this._lazy.links = this._lazy.links; } return this._lazy.links; } @@ -1578,7 +1577,7 @@ namespace vfs { const entry = normalizeFileSetEntry(container[name]); const file = dirname ? vpath.combine(dirname, name) : name; // eslint-disable-next-line no-null/no-null - if (entry === null || entry === undefined || entry instanceof Unlink || entry instanceof Rmdir) { + if (entry === null || entry === undefined || entry instanceof Unlink) { text += `//// [${file}] unlink\r\n`; } else if (entry instanceof Rmdir) { diff --git a/src/loggedIO/loggedIO.ts b/src/loggedIO/loggedIO.ts index 24b3f815f605e..6018ee1026e3d 100644 --- a/src/loggedIO/loggedIO.ts +++ b/src/loggedIO/loggedIO.ts @@ -94,7 +94,7 @@ namespace Playback { // eslint-disable-line local/one-namespace-per-file function memoize(func: (s: string) => T): Memoized { let lookup: { [s: string]: T } = {}; const run: Memoized = ((s: string) => { - if (lookup.hasOwnProperty(s)) return lookup[s]; + if (ts.hasProperty(lookup, s)) return lookup[s]; return lookup[s] = func(s); }) as Memoized; run.reset = () => { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 3ab9f02741cc1..7b8e091a96205 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -940,7 +940,7 @@ namespace ts.server { // raw is now fixed and ready this.safelist = raw.typesMap; for (const key in raw.simpleMap) { - if (raw.simpleMap.hasOwnProperty(key)) { + if (hasProperty(raw.simpleMap, key)) { this.legacySafelist.set(key, raw.simpleMap[key].toLowerCase()); } } diff --git a/src/server/session.ts b/src/server/session.ts index 4bdadd04a15fa..f0d26443dd522 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -297,7 +297,7 @@ namespace ts.server { interface ProjectNavigateToItems { project: Project; navigateToItems: readonly NavigateToItem[]; - }; + } function createDocumentSpanSet(): Set { return createSet(({textSpan}) => textSpan.start + 100003 * textSpan.length, documentSpansEqual); diff --git a/src/services/completions.ts b/src/services/completions.ts index eb2933f3682ae..afea634c32b2c 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1107,7 +1107,7 @@ namespace ts.Completions { return { isSnippet, insertText, labelDetails }; - }; + } function createObjectLiteralMethod( symbol: Symbol, @@ -4335,7 +4335,7 @@ namespace ts.Completions { function isArrowFunctionBody(node: Node) { return node.parent && isArrowFunction(node.parent) && node.parent.body === node; - }; + } /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol: Symbol, checker: TypeChecker, seenModules = new Map()): boolean { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 637201b0c2546..85e67eb8cbb59 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -411,23 +411,23 @@ namespace ts.formatting { } function isOptionEnabled(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean { - return (context) => context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; + return (context) => context.options && hasProperty(context.options, optionName) && !!context.options[optionName]; } function isOptionDisabled(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean { - return (context) => context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; + return (context) => context.options && hasProperty(context.options, optionName) && !context.options[optionName]; } function isOptionDisabledOrUndefined(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean { - return (context) => !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; + return (context) => !context.options || !hasProperty(context.options, optionName) || !context.options[optionName]; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean { - return (context) => !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); + return (context) => !context.options || !hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); } function isOptionEnabledOrUndefined(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean { - return (context) => !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; + return (context) => !context.options || !hasProperty(context.options, optionName) || !!context.options[optionName]; } function isForContext(context: FormattingContext): boolean { diff --git a/src/services/refactors/convertExport.ts b/src/services/refactors/convertExport.ts index cb79dd2672fa4..ffde52b9571ab 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -54,7 +54,7 @@ namespace ts.refactor { readonly exportName: Identifier; // This is exportNode.name except for VariableStatement_s. readonly wasDefault: boolean; readonly exportingModuleSymbol: Symbol; - }; + } function getInfo(context: RefactorContext, considerPartialSpans = true): ExportInfo | RefactorErrorInfo | undefined { const { file, program } = context; diff --git a/src/services/refactors/convertToOptionalChainExpression.ts b/src/services/refactors/convertToOptionalChainExpression.ts index ba40ec6a5e553..a8c13e42f94fc 100644 --- a/src/services/refactors/convertToOptionalChainExpression.ts +++ b/src/services/refactors/convertToOptionalChainExpression.ts @@ -51,7 +51,7 @@ namespace ts.refactor.convertToOptionalChainExpression { finalExpression: PropertyAccessExpression | ElementAccessExpression | CallExpression, occurrences: Occurrence[], expression: ValidExpression, - }; + } type ValidExpressionOrStatement = ValidExpression | ValidStatement; @@ -119,7 +119,7 @@ namespace ts.refactor.convertToOptionalChainExpression { function getBinaryInfo(expression: BinaryExpression): OptionalChainInfo | RefactorErrorInfo | undefined { if (expression.operatorToken.kind !== SyntaxKind.AmpersandAmpersandToken) { return { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_logical_AND_access_chains) }; - }; + } const finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_convertible_access_expression) }; diff --git a/src/services/refactors/helpers.ts b/src/services/refactors/helpers.ts index e86229af915d1..25fcc1a3f5bc1 100644 --- a/src/services/refactors/helpers.ts +++ b/src/services/refactors/helpers.ts @@ -5,7 +5,7 @@ namespace ts.refactor { */ export interface RefactorErrorInfo { error: string; - }; + } /** * Checks if some refactor info has refactor error info. diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index 287178169e6c1..b01218a95ba5a 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -97,7 +97,7 @@ namespace ts.refactor { // Filters imports and prologue directives out of the range of statements to move. // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. - return !isPureImport(statement) && !isPrologueDirective(statement);; + return !isPureImport(statement) && !isPrologueDirective(statement); } function isPureImport(node: Node): boolean { diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 922e50654bbe1..33b508017683a 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -935,7 +935,7 @@ namespace ts.Completions.StringCompletions { const dependencies: object | undefined = (contents as any)[key]; if (!dependencies) continue; for (const dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !startsWith(dep, "@types/")) { + if (hasProperty(dependencies, dep) && !startsWith(dep, "@types/")) { result.push(dep); } } diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index 72374f846115f..3bcad56dd68ab 100644 --- a/src/testRunner/unittests/tsbuild/outputPaths.ts +++ b/src/testRunner/unittests/tsbuild/outputPaths.ts @@ -19,7 +19,7 @@ namespace ts { it("verify getOutputFileNames", () => { const sys = new fakes.System(input.fs().makeReadonly(), { executingFilePath: "/lib/tsc" }) as TscCompileSystem; - ; + assert.deepEqual( getOutputFileNames( parseConfigFileWithSystem("/src/tsconfig.json", {}, /*extendedConfigCache*/ undefined, {}, sys, noop)!, diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 8d7be8e8ae4ab..323e07a876d1a 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -836,7 +836,7 @@ namespace ts.projectSystem { checkAllErrors(request); } - interface SkipErrors { semantic?: true; suggestion?: true }; + interface SkipErrors { semantic?: true; suggestion?: true } export interface CheckAllErrors extends VerifyGetErrRequestBase { files: readonly any[]; skip?: readonly (SkipErrors | undefined)[]; diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index 84d09a3dbda25..10cc61ff6cd03 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -567,7 +567,7 @@ namespace ts.projectSystem { path: "/a/b/file1.js", content: "var x = 10;", fileName: "/a/b/file1.js", - scriptKind: "JS" as "JS" + scriptKind: "JS" as const }; const host = createServerHost([]);