Skip to content

Commit 538130f

Browse files
committed
Don't complain unless declaration emit is enabled
1 parent 5560b81 commit 538130f

10 files changed

+3
-414
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41991,7 +41991,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4199141991
}
4199241992

4199341993
if (
41994-
!(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature))
41994+
getEmitDeclarations(compilerOptions)
41995+
&& !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature))
4199541996
&& !shouldPrintWithInitializer(node)
4199641997
&& !isPrivateDeclaration(node)
4199741998
&& isVisibleExternally(node)

tests/baselines/reference/importCallExpression5ES2020.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
2.ts(2,7): error TS2856: The type of this declaration is ambiguous and may be observed as either 'string | undefined' or '"./0" | undefined'.
21
2.ts(3,23): error TS7036: Dynamic import's specifier must be of type 'string', but here has type '"./0" | undefined'.
32
2.ts(4,24): error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'undefined'.
43
2.ts(5,24): error TS7036: Dynamic import's specifier must be of type 'string', but here has type '"./1" | null'.
@@ -15,11 +14,9 @@
1514
==== 1.ts (0 errors) ====
1615
export function backup() { return "backup"; }
1716

18-
==== 2.ts (5 errors) ====
17+
==== 2.ts (4 errors) ====
1918
declare function bar(): boolean;
2019
const specify = bar() ? "./0" : undefined;
21-
~~~~~~~
22-
!!! error TS2856: The type of this declaration is ambiguous and may be observed as either 'string | undefined' or '"./0" | undefined'.
2320
let myModule = import(specify);
2421
~~~~~~~
2522
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type '"./0" | undefined'.

tests/baselines/reference/inferenceOptionalPropertiesToIndexSignatures.errors.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

tests/baselines/reference/jsdocImportTypeReferenceToStringLiteral.errors.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/baselines/reference/literalTypes2.errors.txt

Lines changed: 0 additions & 188 deletions
This file was deleted.

tests/baselines/reference/nullishCoalescingOperator2.errors.txt

Lines changed: 0 additions & 41 deletions
This file was deleted.

tests/baselines/reference/nullishCoalescingOperator3.errors.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/baselines/reference/nullishCoalescingOperator7.errors.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)