Skip to content

Commit 2483843

Browse files
authored
Move ID error to favor class expression inference failure when present (#4523)
1 parent 6a49d85 commit 2483843

4 files changed

Lines changed: 4 additions & 24 deletions

File tree

internal/pseudochecker/lookup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func (ch *PseudoChecker) typeFromExpression(node *ast.Node) *PseudoType {
289289
case ast.KindObjectLiteralExpression:
290290
return ch.typeFromObjectLiteral(node.AsObjectLiteralExpression())
291291
case ast.KindClassExpression:
292-
return NewPseudoTypeInferred(node, false) // No possible annotation/directly mappable syntax
292+
return NewPseudoTypeInferredWithErrors(node, false, []*ast.Node{node}) // No possible annotation/directly mappable syntax
293293
case ast.KindTemplateExpression:
294294
// templateLitWithHoles as const, not supported
295295
if IsInConstContext(node) {

testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClassesExpressions.errors.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
isolatedDeclarationErrorsClassesExpressions.ts(1,14): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
1+
isolatedDeclarationErrorsClassesExpressions.ts(1,20): error TS9022: Inference from class expressions is not supported with --isolatedDeclarations.
22
isolatedDeclarationErrorsClassesExpressions.ts(15,26): error TS9021: Extends clause can't contain an expression with --isolatedDeclarations.
33
isolatedDeclarationErrorsClassesExpressions.ts(19,25): error TS9022: Inference from class expressions is not supported with --isolatedDeclarations.
44
isolatedDeclarationErrorsClassesExpressions.ts(19,35): error TS9022: Inference from class expressions is not supported with --isolatedDeclarations.
55

66

77
==== isolatedDeclarationErrorsClassesExpressions.ts (4 errors) ====
88
export const cls = class {
9-
~~~
10-
!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
9+
~~~~~
10+
!!! error TS9022: Inference from class expressions is not supported with --isolatedDeclarations.
1111
!!! related TS9027 isolatedDeclarationErrorsClassesExpressions.ts:1:14: Add a type annotation to the variable cls.
1212
foo: string = "";
1313
}

testdata/baselines/reference/submoduleTriaged/compiler/isolatedDeclarationErrorsClassesExpressions.errors.txt.diff

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

testdata/submoduleTriaged.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
# Omnibus: Isolated declarations error changes - needs investigation
66
## https://github.com/microsoft/typescript-go/issues/3477
7-
compiler/isolatedDeclarationErrorsClassesExpressions.errors.txt.diff
87
compiler/isolatedDeclarationsAddUndefined.errors.txt.diff
98

109
# Corsa changes how module augmentation interacts with export-equals and exported name visibility

0 commit comments

Comments
 (0)