Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6080c3e

Browse filesBrowse files
author
Kanchalai Tanglertsampan
committed
Remove error with noImplicitAny
1 parent 486dc91 commit 6080c3e
Copy full SHA for 6080c3e

4 files changed

+7-29Lines changed: 7 additions & 29 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/compiler/checker.ts‎

Copy file name to clipboardExpand all lines: src/compiler/checker.ts
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ namespace ts {
284284
let deferredGlobalAsyncIterableIteratorType: GenericType;
285285
let deferredGlobalTemplateStringsArrayType: ObjectType;
286286
let deferredJsxElementClassType: Type;
287-
let deferredGlobalPromiseAnyType: Type;
288287

289288
let deferredNodes: Node[];
290289
let deferredUnusedIdentifierNodes: Node[];
@@ -3456,11 +3455,6 @@ namespace ts {
34563455
// Use the type of the initializer expression if one is present
34573456
if (declaration.initializer) {
34583457
const type = checkDeclarationInitializer(declaration);
3459-
3460-
if (isImportCall(declaration.initializer)) {
3461-
if (noImplicitAny && type === getGlobalPromiseAnyType()) {
3462-
error(declaration, Diagnostics.Cannot_resolve_dynamic_import_implicitly_has_a_Promise_any_type); }
3463-
}
34643458
return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality);
34653459
}
34663460

@@ -6089,10 +6083,6 @@ namespace ts {
60896083
return deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", /*arity*/ 1, reportErrors)) || emptyGenericType;
60906084
}
60916085

6092-
function getGlobalPromiseAnyType() {
6093-
return deferredGlobalPromiseAnyType || (deferredGlobalPromiseAnyType = createPromiseType(anyType));
6094-
}
6095-
60966086
function getGlobalPromiseConstructorSymbol(reportErrors: boolean): Symbol | undefined {
60976087
return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors));
60986088
}
Collapse file

‎src/compiler/diagnosticMessages.json‎

Copy file name to clipboardExpand all lines: src/compiler/diagnosticMessages.json
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"Unterminated string literal.": {
33
"category": "Error",
44
"code": 1002
@@ -3174,14 +3174,11 @@
31743174
"category": "Error",
31753175
"code": 7034
31763176
},
3177-
"Cannot resolve dynamic import, implicitly has a 'Promise<any>' type.": {
3178-
"category": "Error",
3179-
"code": 7035
3180-
},
31813177
"Dynamic import's specifier must be of type 'string', but here has type '{0}'.": {
3182-
"category": "Error",
3183-
"code": 7036
3178+
"category": "Error",
3179+
"code": 7035
31843180
},
3181+
31853182
"You cannot rename this element.": {
31863183
"category": "Error",
31873184
"code": 8000
Collapse file

‎tests/cases/conformance/es2018/dynamicImport/importCallExpressionNoImplicitAnyError.ts‎

Copy file name to clipboardExpand all lines: tests/cases/conformance/es2018/dynamicImport/importCallExpressionNoImplicitAnyError.ts
-12Lines changed: 0 additions & 12 deletions
This file was deleted.
Collapse file

‎tests/cases/conformance/es2018/dynamicImport/importCallExpressionReturnPromiseOfAny.ts‎

Copy file name to clipboardExpand all lines: tests/cases/conformance/es2018/dynamicImport/importCallExpressionReturnPromiseOfAny.ts
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ export class C {}
77
// @filename: 1.ts
88
import * as defaultModule from "./defaultPath";
99
declare function getSpecifier(): string;
10+
declare function ValidSomeCondition(): boolean;
1011
declare var whatToLoad: boolean;
1112
declare const directory: string;
1213
declare const moduleFile: number;
1314

1415
import(`${directory}\${moduleFile}`);
1516
import(getSpecifier());
17+
18+
var p1 = import(ValidSomeCondition() ? "./0" : "externalModule");
1619
var p1: Promise<any> = import(getSpecifier());
1720
var p11: Promise<typeof defaultModule> = import(getSpecifier());
1821
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath") as Promise<typeof defaultModule>;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.