diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index b7d0d6f0f0e..af610e5bf9b 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2713,6 +2713,7 @@ namespace ts { // If this is a property-parameter, then also declare the property symbol into the // containing class. if (isParameterPropertyDeclaration(node)) { + // tslint:disable-next-line no-unnecessary-type-assertion const classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members!, classDeclaration.symbol, node, SymbolFlags.Property | (node.questionToken ? SymbolFlags.Optional : SymbolFlags.None), SymbolFlags.PropertyExcludes); } diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index fbc2dc3f7d2..be9674bc550 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -70,6 +70,7 @@ namespace ts { if (useOldState) { // Verify the sanity of old state if (!oldState!.currentChangedFilePath) { + // tslint:disable-next-line no-unnecessary-type-assertion Debug.assert(!oldState!.affectedFiles && (!oldState!.currentAffectedFilesSignatures || !oldState!.currentAffectedFilesSignatures!.size), "Cannot reuse if only few affected files of currentChangedFile were iterated"); } if (canCopySemanticDiagnostics) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0c5807f7519..c2009ee59c0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9226,6 +9226,7 @@ namespace ts { break; } } + // tslint:disable-next-line no-unnecessary-type-assertion return links.resolvedType!; // TODO: GH#18217 } @@ -24883,7 +24884,9 @@ namespace ts { if (node.kind === SyntaxKind.VariableDeclaration || node.kind === SyntaxKind.BindingElement) { checkVarDeclaredNamesNotShadowed(node); } + // tslint:disable-next-line no-unnecessary-type-assertion checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + // tslint:disable-next-line no-unnecessary-type-assertion checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } @@ -29493,9 +29496,11 @@ namespace ts { node.kind === SyntaxKind.FunctionExpression || node.kind === SyntaxKind.MethodDeclaration); if (node.flags & NodeFlags.Ambient) { + // tslint:disable-next-line no-unnecessary-type-assertion return grammarErrorOnNode(node.asteriskToken!, Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } if (!node.body) { + // tslint:disable-next-line no-unnecessary-type-assertion return grammarErrorOnNode(node.asteriskToken!, Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); } } @@ -29536,6 +29541,7 @@ namespace ts { // Modifiers are never allowed on properties except for 'async' on a method declaration if (prop.modifiers) { + // tslint:disable-next-line no-unnecessary-type-assertion for (const mod of prop.modifiers!) { // TODO: GH#19955 if (mod.kind !== SyntaxKind.AsyncKeyword || prop.kind !== SyntaxKind.MethodDeclaration) { grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); @@ -29922,13 +29928,16 @@ namespace ts { const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConst(node); if (isConstOrReadonly && !node.type) { if (isInvalidInitializer) { + // tslint:disable-next-line no-unnecessary-type-assertion return grammarErrorOnNode(node.initializer!, Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference); } } else { + // tslint:disable-next-line no-unnecessary-type-assertion return grammarErrorOnNode(node.initializer!, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); } if (!isConstOrReadonly || isInvalidInitializer) { + // tslint:disable-next-line no-unnecessary-type-assertion return grammarErrorOnNode(node.initializer!, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index fe54402d434..fb642bf3e9a 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -225,6 +225,7 @@ namespace ts { Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform"); printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], /* bundleInfopath*/ undefined, declarationPrinter, declarationSourceMap); if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === SyntaxKind.SourceFile) { + // tslint:disable-next-line no-unnecessary-type-assertion const sourceFile = declarationTransform.transformed[0] as SourceFile; exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index d2ae81ccad6..3b771a183ab 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7785,12 +7785,15 @@ namespace ts { context.hasNoDefaultLib = true; } else if (arg!.arguments.types) { + // tslint:disable-next-line no-unnecessary-type-assertion typeReferenceDirectives.push({ pos: arg!.arguments.types!.pos, end: arg!.arguments.types!.end, fileName: arg!.arguments.types!.value }); } else if (arg!.arguments.lib) { + // tslint:disable-next-line no-unnecessary-type-assertion libReferenceDirectives.push({ pos: arg!.arguments.lib!.pos, end: arg!.arguments.lib!.end, fileName: arg!.arguments.lib!.value }); } else if (arg!.arguments.path) { + // tslint:disable-next-line no-unnecessary-type-assertion referencedFiles.push({ pos: arg!.arguments.path!.pos, end: arg!.arguments.path!.end, fileName: arg!.arguments.path!.value }); } else { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 00e35fb0a85..46f80df3355 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3378,10 +3378,12 @@ namespace ts { } if (member.kind === SyntaxKind.GetAccessor && !getAccessor) { + // tslint:disable-next-line no-unnecessary-type-assertion getAccessor = member; } if (member.kind === SyntaxKind.SetAccessor && !setAccessor) { + // tslint:disable-next-line no-unnecessary-type-assertion setAccessor = member; } } diff --git a/src/harness/compiler.ts b/src/harness/compiler.ts index 7d41545708b..e21626a04e5 100644 --- a/src/harness/compiler.ts +++ b/src/harness/compiler.ts @@ -183,7 +183,9 @@ namespace compiler { } public getSourceMapRecord(): string | undefined { + // tslint:disable-next-line no-unnecessary-type-assertion if (this.result!.sourceMaps && this.result!.sourceMaps!.length > 0) { + // tslint:disable-next-line no-unnecessary-type-assertion return Harness.SourceMapRecorder.getSourceMapRecord(this.result!.sourceMaps!, this.program!, Array.from(this.js.values()).filter(d => !ts.fileExtensionIs(d.file, ts.Extension.Json)), Array.from(this.dts.values())); } }