diff --git a/internal/checker/pseudotypenodebuilder.go b/internal/checker/pseudotypenodebuilder.go index cf8046803f9..c4b3acedd03 100644 --- a/internal/checker/pseudotypenodebuilder.go +++ b/internal/checker/pseudotypenodebuilder.go @@ -174,6 +174,8 @@ func (b *NodeBuilderImpl) pseudoTypeToNode(t *pseudochecker.PseudoType) *ast.Nod return b.f.NewLiteralTypeNode(b.f.NewKeywordExpression(ast.KindFalseKeyword)) case pseudochecker.PseudoTypeKindTrue: return b.f.NewLiteralTypeNode(b.f.NewKeywordExpression(ast.KindTrueKeyword)) + case pseudochecker.PseudoTypeKindVoid: + return b.f.NewKeywordTypeNode(ast.KindVoidKeyword) case pseudochecker.PseudoTypeKindSingleCallSignature: d := t.AsPseudoTypeSingleCallSignature() signature := b.ch.getSignatureFromDeclaration(d.Signature) @@ -753,6 +755,8 @@ func (b *NodeBuilderImpl) pseudoTypeToType(t *pseudochecker.PseudoType) *Type { return b.ch.falseType case pseudochecker.PseudoTypeKindTrue: return b.ch.trueType + case pseudochecker.PseudoTypeKindVoid: + return b.ch.voidType case pseudochecker.PseudoTypeKindStringLiteral, pseudochecker.PseudoTypeKindNumericLiteral, pseudochecker.PseudoTypeKindBigIntLiteral: source := t.AsPseudoTypeLiteral().Node return b.ch.getRegularTypeOfExpression(source) // big shortcut, uses cached expression types where possible diff --git a/internal/fourslash/_scripts/failingTests.txt b/internal/fourslash/_scripts/failingTests.txt index a4292fe50f3..f9f643f6e91 100644 --- a/internal/fourslash/_scripts/failingTests.txt +++ b/internal/fourslash/_scripts/failingTests.txt @@ -61,9 +61,12 @@ TestCodeFixInferFromUsageRestParam2 TestCodeFixInferFromUsageRestParam3 TestCodeFixInferFromUsageVariable3JS TestCodeFixMissingTypeAnnotationOnExports16 +TestCodeFixMissingTypeAnnotationOnExports22_formatting TestCodeFixMissingTypeAnnotationOnExports23_heritage_formatting TestCodeFixMissingTypeAnnotationOnExports25_heritage_formatting_3 TestCodeFixMissingTypeAnnotationOnExports28_long_types +TestCodeFixMissingTypeAnnotationOnExports33_methods +TestCodeFixMissingTypeAnnotationOnExports43_expando_functions_2 TestCodeFixSpelling4 TestCodeFixSpelling5 TestCodeFixSpellingCaseSensitive1 diff --git a/internal/fourslash/tests/manual/codeFixMissingTypeAnnotationOnExports46-decorators-experimental_test.go b/internal/fourslash/tests/manual/codeFixMissingTypeAnnotationOnExports46-decorators-experimental_test.go index 59e717e5ee4..f1c136ff932 100644 --- a/internal/fourslash/tests/manual/codeFixMissingTypeAnnotationOnExports46-decorators-experimental_test.go +++ b/internal/fourslash/tests/manual/codeFixMissingTypeAnnotationOnExports46-decorators-experimental_test.go @@ -61,7 +61,7 @@ export class A { getSelf(): this { return this; } - passParameter(@parameterDecorator() param: number = foo()): void {} + passParameter(@parameterDecorator() param: number = foo()) {} @getterDecorator() get a(): number { return foo(); diff --git a/internal/pseudochecker/lookup.go b/internal/pseudochecker/lookup.go index 015f88f313a..b658fa12c67 100644 --- a/internal/pseudochecker/lookup.go +++ b/internal/pseudochecker/lookup.go @@ -223,6 +223,9 @@ func (ch *PseudoChecker) typeFromSingleReturnExpression(fn *ast.Node) *PseudoTyp body := fn.Body() if ast.IsBlock(body) { + if len(body.Statements()) == 0 { + return PseudoTypeVoid + } ast.ForEachReturnStatement(body, func(stmt *ast.Node) bool { if stmt.Parent != body { // Why bail on nested return statements? candidateExpr = nil diff --git a/internal/pseudochecker/type.go b/internal/pseudochecker/type.go index 6966ed811e1..425bd365c7b 100644 --- a/internal/pseudochecker/type.go +++ b/internal/pseudochecker/type.go @@ -33,6 +33,7 @@ const ( PseudoTypeKindBoolean PseudoTypeKindFalse PseudoTypeKindTrue + PseudoTypeKindVoid PseudoTypeKindSingleCallSignature PseudoTypeKindTuple PseudoTypeKindObjectLiteral @@ -77,6 +78,7 @@ var ( PseudoTypeBoolean = newPseudoType(PseudoTypeKindBoolean, &PseudoTypeBase{}) PseudoTypeFalse = newPseudoType(PseudoTypeKindFalse, &PseudoTypeBase{}) PseudoTypeTrue = newPseudoType(PseudoTypeKindTrue, &PseudoTypeBase{}) + PseudoTypeVoid = newPseudoType(PseudoTypeKindVoid, &PseudoTypeBase{}) ) // PseudoTypeDirect directly encodes the type referred to by a given TypeNode diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.errors.txt index 2bc5caf198c..8671d84aa7c 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.errors.txt @@ -1,10 +1,9 @@ isolatedDeclarationErrors.ts(2,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. isolatedDeclarationErrors.ts(5,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. -isolatedDeclarationErrors.ts(7,30): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrors.ts(8,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. -==== isolatedDeclarationErrors.ts (4 errors) ==== +==== isolatedDeclarationErrors.ts (3 errors) ==== function errorOnAssignmentBelowDecl(): void {} errorOnAssignmentBelowDecl.a = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -16,10 +15,6 @@ isolatedDeclarationErrors.ts(8,1): error TS9023: Assigning properties to functio !!! error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. const errorOnMissingReturn = () => {} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationErrors.ts:7:7: Add a type annotation to the variable errorOnMissingReturn. -!!! related TS9030 isolatedDeclarationErrors.ts:7:30: Add a return type to the function expression. errorOnMissingReturn.a = ""; ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.errors.txt.diff new file mode 100644 index 00000000000..2d6c3665ab2 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.isolatedDeclarationErrors.errors.txt ++++ new.isolatedDeclarationErrors.errors.txt +@@= skipped -0, +0 lines =@@ + isolatedDeclarationErrors.ts(2,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. + isolatedDeclarationErrors.ts(5,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. +-isolatedDeclarationErrors.ts(7,30): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. + isolatedDeclarationErrors.ts(8,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. + + +-==== isolatedDeclarationErrors.ts (4 errors) ==== ++==== isolatedDeclarationErrors.ts (3 errors) ==== + function errorOnAssignmentBelowDecl(): void {} + errorOnAssignmentBelowDecl.a = ""; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@@= skipped -15, +14 lines =@@ + !!! error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. + + const errorOnMissingReturn = () => {} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9027 isolatedDeclarationErrors.ts:7:7: Add a type annotation to the variable errorOnMissingReturn. +-!!! related TS9030 isolatedDeclarationErrors.ts:7:30: Add a return type to the function expression. + errorOnMissingReturn.a = ""; + ~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.errors.txt index 7e9b2904f7a..416a41adb20 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.errors.txt @@ -1,5 +1,4 @@ isolatedDeclarationErrorsClasses.ts(3,5): error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsClasses.ts(4,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsClasses.ts(8,18): error TS7006: Parameter 'p' implicitly has an 'any' type. isolatedDeclarationErrorsClasses.ts(8,18): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsClasses.ts(9,23): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. @@ -11,7 +10,6 @@ isolatedDeclarationErrorsClasses.ts(36,5): error TS9038: Computed property names isolatedDeclarationErrorsClasses.ts(36,6): error TS2304: Cannot find name 'missing'. isolatedDeclarationErrorsClasses.ts(38,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. isolatedDeclarationErrorsClasses.ts(40,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -isolatedDeclarationErrorsClasses.ts(42,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsClasses.ts(42,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. isolatedDeclarationErrorsClasses.ts(44,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. isolatedDeclarationErrorsClasses.ts(44,35): error TS7006: Parameter 'v' implicitly has an 'any' type. @@ -26,7 +24,7 @@ isolatedDeclarationErrorsClasses.ts(56,5): error TS7010: '[noAnnotationLiteralNa isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't be inferred with --isolatedDeclarations. -==== isolatedDeclarationErrorsClasses.ts (26 errors) ==== +==== isolatedDeclarationErrorsClasses.ts (24 errors) ==== export class Cls { field = 1 + 1; @@ -34,9 +32,6 @@ isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't b !!! error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. !!! related TS9029 isolatedDeclarationErrorsClasses.ts:3:5: Add a type annotation to the property field. method() {} - ~~~~~~ -!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9034 isolatedDeclarationErrorsClasses.ts:4:5: Add a return type to the method methodOk(): void {} @@ -102,9 +97,6 @@ isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't b [noAnnotationStringName]() { } ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9034 isolatedDeclarationErrorsClasses.ts:42:5: Add a return type to the method - ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. [noParamAnnotationStringName](v): void { } diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.errors.txt.diff new file mode 100644 index 00000000000..25abdeeb2d1 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.errors.txt.diff @@ -0,0 +1,45 @@ +--- old.isolatedDeclarationErrorsClasses.errors.txt ++++ new.isolatedDeclarationErrorsClasses.errors.txt +@@= skipped -0, +0 lines =@@ + isolatedDeclarationErrorsClasses.ts(3,5): error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsClasses.ts(4,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. + isolatedDeclarationErrorsClasses.ts(8,18): error TS7006: Parameter 'p' implicitly has an 'any' type. + isolatedDeclarationErrorsClasses.ts(8,18): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. + isolatedDeclarationErrorsClasses.ts(9,23): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. +@@= skipped -10, +9 lines =@@ + isolatedDeclarationErrorsClasses.ts(36,6): error TS2304: Cannot find name 'missing'. + isolatedDeclarationErrorsClasses.ts(38,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + isolatedDeclarationErrorsClasses.ts(40,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +-isolatedDeclarationErrorsClasses.ts(42,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. + isolatedDeclarationErrorsClasses.ts(42,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + isolatedDeclarationErrorsClasses.ts(44,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + isolatedDeclarationErrorsClasses.ts(44,35): error TS7006: Parameter 'v' implicitly has an 'any' type. +@@= skipped -15, +14 lines =@@ + isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't be inferred with --isolatedDeclarations. + + +-==== isolatedDeclarationErrorsClasses.ts (26 errors) ==== ++==== isolatedDeclarationErrorsClasses.ts (24 errors) ==== + export class Cls { + + field = 1 + 1; +@@= skipped -8, +8 lines =@@ + !!! error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. + !!! related TS9029 isolatedDeclarationErrorsClasses.ts:3:5: Add a type annotation to the property field. + method() {} +- ~~~~~~ +-!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9034 isolatedDeclarationErrorsClasses.ts:4:5: Add a return type to the method + + methodOk(): void {} + +@@= skipped -67, +64 lines =@@ + !!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + + [noAnnotationStringName]() { } +- ~~~~~~~~~~~~~~~~~~~~~~~~ +-!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9034 isolatedDeclarationErrorsClasses.ts:42:5: Add a return type to the method + ~~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.errors.txt index adc2ffbf0df..6ab24b85860 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.errors.txt @@ -1,4 +1,3 @@ -isolatedDeclarationErrorsExpandoFunctions.ts(1,17): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsExpandoFunctions.ts(3,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. isolatedDeclarationErrorsExpandoFunctions.ts(4,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. isolatedDeclarationErrorsExpandoFunctions.ts(5,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. @@ -7,11 +6,8 @@ isolatedDeclarationErrorsExpandoFunctions.ts(7,1): error TS9023: Assigning prope isolatedDeclarationErrorsExpandoFunctions.ts(8,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. -==== isolatedDeclarationErrorsExpandoFunctions.ts (7 errors) ==== +==== isolatedDeclarationErrorsExpandoFunctions.ts (6 errors) ==== export function foo() {} - ~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9031 isolatedDeclarationErrorsExpandoFunctions.ts:1:17: Add a return type to the function declaration. foo.apply = () => {} ~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.errors.txt.diff new file mode 100644 index 00000000000..b9b639745e8 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.errors.txt.diff @@ -0,0 +1,20 @@ +--- old.isolatedDeclarationErrorsExpandoFunctions.errors.txt ++++ new.isolatedDeclarationErrorsExpandoFunctions.errors.txt +@@= skipped -0, +0 lines =@@ +-isolatedDeclarationErrorsExpandoFunctions.ts(1,17): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. + isolatedDeclarationErrorsExpandoFunctions.ts(3,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. + isolatedDeclarationErrorsExpandoFunctions.ts(4,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. + isolatedDeclarationErrorsExpandoFunctions.ts(5,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. +@@= skipped -6, +5 lines =@@ + isolatedDeclarationErrorsExpandoFunctions.ts(8,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. + + +-==== isolatedDeclarationErrorsExpandoFunctions.ts (7 errors) ==== ++==== isolatedDeclarationErrorsExpandoFunctions.ts (6 errors) ==== + export function foo() {} +- ~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9031 isolatedDeclarationErrorsExpandoFunctions.ts:1:17: Add a return type to the function declaration. + + foo.apply = () => {} + ~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsFunctionDeclarations.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsFunctionDeclarations.errors.txt index cbec933ded0..3d3b066c1a8 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsFunctionDeclarations.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsFunctionDeclarations.errors.txt @@ -1,4 +1,3 @@ -isolatedDeclarationErrorsFunctionDeclarations.ts(1,17): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsFunctionDeclarations.ts(3,35): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsFunctionDeclarations.ts(7,49): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsFunctionDeclarations.ts(7,66): error TS9013: Expression type can't be inferred with --isolatedDeclarations. @@ -6,11 +5,8 @@ isolatedDeclarationErrorsFunctionDeclarations.ts(7,81): error TS9013: Expression isolatedDeclarationErrorsFunctionDeclarations.ts(9,55): error TS9013: Expression type can't be inferred with --isolatedDeclarations. -==== isolatedDeclarationErrorsFunctionDeclarations.ts (6 errors) ==== +==== isolatedDeclarationErrorsFunctionDeclarations.ts (5 errors) ==== export function noReturn() {} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9031 isolatedDeclarationErrorsFunctionDeclarations.ts:1:17: Add a return type to the function declaration. export function noParamAnnotation(p): void {} ~ diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsFunctionDeclarations.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsFunctionDeclarations.errors.txt.diff new file mode 100644 index 00000000000..e7431ea0d33 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsFunctionDeclarations.errors.txt.diff @@ -0,0 +1,20 @@ +--- old.isolatedDeclarationErrorsFunctionDeclarations.errors.txt ++++ new.isolatedDeclarationErrorsFunctionDeclarations.errors.txt +@@= skipped -0, +0 lines =@@ +-isolatedDeclarationErrorsFunctionDeclarations.ts(1,17): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. + isolatedDeclarationErrorsFunctionDeclarations.ts(3,35): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. + isolatedDeclarationErrorsFunctionDeclarations.ts(7,49): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. + isolatedDeclarationErrorsFunctionDeclarations.ts(7,66): error TS9013: Expression type can't be inferred with --isolatedDeclarations. +@@= skipped -5, +4 lines =@@ + isolatedDeclarationErrorsFunctionDeclarations.ts(9,55): error TS9013: Expression type can't be inferred with --isolatedDeclarations. + + +-==== isolatedDeclarationErrorsFunctionDeclarations.ts (6 errors) ==== ++==== isolatedDeclarationErrorsFunctionDeclarations.ts (5 errors) ==== + export function noReturn() {} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9031 isolatedDeclarationErrorsFunctionDeclarations.ts:1:17: Add a return type to the function declaration. + + export function noParamAnnotation(p): void {} + ~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt index 8fa23907bd2..3bf5c1d3d94 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt @@ -1,11 +1,7 @@ isolatedDeclarationErrorsObjects.ts(7,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(12,12): error TS9013: Expression type can't be inferred with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(16,12): error TS9013: Expression type can't be inferred with --isolatedDeclarations. -isolatedDeclarationErrorsObjects.ts(21,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsObjects.ts(24,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(25,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. -isolatedDeclarationErrorsObjects.ts(29,9): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsObjects.ts(32,9): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(40,9): error TS7032: Property 'singleSetterBad' implicitly has type 'any', because its set accessor lacks a parameter type annotation. isolatedDeclarationErrorsObjects.ts(40,25): error TS7006: Parameter 'value' implicitly has an 'any' type. isolatedDeclarationErrorsObjects.ts(40,25): error TS9009: At least one accessor must have an explicit type annotation with --isolatedDeclarations. @@ -19,7 +15,7 @@ isolatedDeclarationErrorsObjects.ts(77,5): error TS9016: Objects that contain sh isolatedDeclarationErrorsObjects.ts(84,9): error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. -==== isolatedDeclarationErrorsObjects.ts (19 errors) ==== +==== isolatedDeclarationErrorsObjects.ts (15 errors) ==== export let o = { a: 1, b: "" @@ -53,17 +49,9 @@ isolatedDeclarationErrorsObjects.ts(84,9): error TS9015: Objects that contain sp export let oWithMethods = { method() { }, - ~~~~~~ -!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationErrorsObjects.ts:20:12: Add a type annotation to the variable oWithMethods. -!!! related TS9034 isolatedDeclarationErrorsObjects.ts:21:5: Add a return type to the method okMethod(): void { }, a: 1, bad() { }, - ~~~ -!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationErrorsObjects.ts:20:12: Add a type annotation to the variable oWithMethods. -!!! related TS9034 isolatedDeclarationErrorsObjects.ts:24:5: Add a return type to the method e: V, ~ !!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. @@ -73,17 +61,9 @@ isolatedDeclarationErrorsObjects.ts(84,9): error TS9015: Objects that contain sp export let oWithMethodsNested = { foo: { method() { }, - ~~~~~~ -!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. -!!! related TS9034 isolatedDeclarationErrorsObjects.ts:29:9: Add a return type to the method a: 1, okMethod(): void { }, bad() { } - ~~~ -!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. -!!! related TS9034 isolatedDeclarationErrorsObjects.ts:32:9: Add a return type to the method } } diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt.diff new file mode 100644 index 00000000000..fb07d7d2353 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt.diff @@ -0,0 +1,59 @@ +--- old.isolatedDeclarationErrorsObjects.errors.txt ++++ new.isolatedDeclarationErrorsObjects.errors.txt +@@= skipped -0, +0 lines =@@ + isolatedDeclarationErrorsObjects.ts(7,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. + isolatedDeclarationErrorsObjects.ts(12,12): error TS9013: Expression type can't be inferred with --isolatedDeclarations. + isolatedDeclarationErrorsObjects.ts(16,12): error TS9013: Expression type can't be inferred with --isolatedDeclarations. +-isolatedDeclarationErrorsObjects.ts(21,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsObjects.ts(24,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. + isolatedDeclarationErrorsObjects.ts(25,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. +-isolatedDeclarationErrorsObjects.ts(29,9): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsObjects.ts(32,9): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. + isolatedDeclarationErrorsObjects.ts(40,9): error TS7032: Property 'singleSetterBad' implicitly has type 'any', because its set accessor lacks a parameter type annotation. + isolatedDeclarationErrorsObjects.ts(40,25): error TS7006: Parameter 'value' implicitly has an 'any' type. + isolatedDeclarationErrorsObjects.ts(40,25): error TS9009: At least one accessor must have an explicit type annotation with --isolatedDeclarations. +@@= skipped -18, +14 lines =@@ + isolatedDeclarationErrorsObjects.ts(84,9): error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. + + +-==== isolatedDeclarationErrorsObjects.ts (19 errors) ==== ++==== isolatedDeclarationErrorsObjects.ts (15 errors) ==== + export let o = { + a: 1, + b: "" +@@= skipped -34, +34 lines =@@ + + export let oWithMethods = { + method() { }, +- ~~~~~~ +-!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9027 isolatedDeclarationErrorsObjects.ts:20:12: Add a type annotation to the variable oWithMethods. +-!!! related TS9034 isolatedDeclarationErrorsObjects.ts:21:5: Add a return type to the method + okMethod(): void { }, + a: 1, + bad() { }, +- ~~~ +-!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9027 isolatedDeclarationErrorsObjects.ts:20:12: Add a type annotation to the variable oWithMethods. +-!!! related TS9034 isolatedDeclarationErrorsObjects.ts:24:5: Add a return type to the method + e: V, + ~ + !!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. +@@= skipped -20, +12 lines =@@ + export let oWithMethodsNested = { + foo: { + method() { }, +- ~~~~~~ +-!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. +-!!! related TS9034 isolatedDeclarationErrorsObjects.ts:29:9: Add a return type to the method + a: 1, + okMethod(): void { }, + bad() { } +- ~~~ +-!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. +-!!! related TS9034 isolatedDeclarationErrorsObjects.ts:32:9: Add a return type to the method + } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.errors.txt deleted file mode 100644 index 4981a650dbc..00000000000 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.errors.txt +++ /dev/null @@ -1,361 +0,0 @@ -isolatedDeclarationErrorsReturnTypes.ts(13,45): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(16,41): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(19,41): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(109,65): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(112,61): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(115,61): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(119,83): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(120,66): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(122,79): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(123,62): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(125,79): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(126,62): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(138,73): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(141,69): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(144,69): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(151,38): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(152,21): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(153,57): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(154,40): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(156,51): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(157,34): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(158,70): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(159,53): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(162,53): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(163,36): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(164,72): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(165,55): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(167,66): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(168,49): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(169,85): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsReturnTypes.ts(170,68): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. - - -==== isolatedDeclarationErrorsReturnTypes.ts (31 errors) ==== - // Function Variables - export const fnExpressionConstVariable = function foo() { return 0;} - export const fnArrowConstVariable = () => "S"; - - export let fnExpressionLetVariable = function foo() { return 0;} - export let fnArrowLetVariable = () => "S"; - - export var fnExpressionVarVariable = function foo() { return 0;} - export var fnArrowVarVariable = () => "S"; - - // No Errors - export const fnExpressionConstVariableOk = function foo(): number { return 0;} - export const fnArrowConstVariableOk = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:13:40: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:13:45: Add a return type to the function expression. - - export let fnExpressionLetVariableOk = function foo(): number { return 0;} - export let fnArrowLetVariableOk = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:16:36: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:16:41: Add a return type to the function expression. - - export var fnExpressionVarVariableOk = function foo(): number { return 0;} - export var fnArrowVarVariableOk = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:19:36: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:19:41: Add a return type to the function expression. - - // Not exported - const fnExpressionConstVariableInternal = function foo() { return 0;} - const fnArrowConstVariableInternal = () => "S"; - - let fnExpressionLetVariableInternal = function foo() { return 0;} - let fnArrowLetVariableInternal = () => "S"; - - var fnExpressionVarVariableInternal = function foo() { return 0;} - var fnArrowVarVariableInternal = () => "S"; - - // Function Fields - export class ExportedClass { - // Should Error - fnExpression = function foo() { return 0; } - fnArrow = () => "S"; - protected fnExpressionProtected = function foo() { return 0; } - protected fnArrowProtected = () => "S"; - - static fnStaticExpression = function foo() { return 0; } - static fnStaticArrow = () => "S"; - protected static fnStaticExpressionProtected = function foo() { return 0; } - protected static fnStaticArrowProtected = () => "S"; - - // Have annotation, so ok - fnExpressionOk = function foo(): number { return 0; } - fnArrowOK = (): string => "S"; - protected fnExpressionProtectedOk = function foo(): number { return 0; } - protected fnArrowProtectedOK = (): string => "S"; - - static fnStaticExpressionOk = function foo(): number { return 0; } - static fnStaticArrowOk = (): string => "S"; - protected static fnStaticExpressionProtectedOk = function foo(): number { return 0; } - protected static fnStaticArrowProtectedOk = (): string => "S"; - - - // No Error not in declarations - private fnExpressionPrivate = function foo() { return 0; } - private fnArrowPrivate = () => "S"; - #fnArrow = () => "S"; - #fnExpression = function foo() { return 0;} - private static fnStaticExpressionPrivate = function foo() { return 0; } - private static fnStaticArrowPrivate = () => "S"; - } - - // Should error - class IndirectlyExportedClass { - fnExpression = function foo() { return 0; } - fnArrow = () => "S"; - - static fnStaticExpression = function foo() { return 0; } - static fnStaticArrow = () => "S"; - - protected static fnStaticExpressionProtected = function foo() { return 0; } - protected static fnStaticArrowProtected = () => "S"; - - private fnExpressionPrivate = function foo() { return 0; } - private fnArrowPrivate = () => "S"; - #fnArrow = () => "S"; - #fnExpression = function foo() { return 0;} - private static fnStaticExpressionPrivate = function foo() { return 0; } - private static fnStaticArrowPrivate = () => "S"; - } - export const instance: IndirectlyExportedClass = new IndirectlyExportedClass(); - - // No Errors - class InternalClass { - fnExpression = function foo() { return 0; } - fnArrow = () => "S"; - - static fnStaticExpression = function foo() { return 0; } - static fnStaticArrow = () => "S"; - - protected static fnStaticExpressionProtected = function foo() { return 0; } - protected static fnStaticArrowProtected = () => "S"; - - private fnExpressionPrivate = function foo() { return 0; } - private fnArrowPrivate = () => "S"; - #fnArrow = () => "S"; - #fnExpression = function foo() { return 0;} - private static fnStaticExpressionPrivate = function foo() { return 0; } - private static fnStaticArrowPrivate = () => "S"; - } - const internalInstance: InternalClass = new InternalClass(); - - - // Function parameters - - // In Function Variables - No annotations - export const fnParamExpressionConstVariable = function foo(cb = function(){ }) { return 0;} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:109:60: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:109:65: Add a return type to the function expression. - export const fnParamArrowConstVariable = (cb = () => 1) => "S"; - - export let fnParamExpressionLetVariable = function foo(cb = function(){ }) { return 0;} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:112:56: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:112:61: Add a return type to the function expression. - export let fnParamArrowLetVariable = (cb = () => 1) => "S"; - - export var fnParamExpressionVarVariable = function foo(cb = function(){ }) { return 0;} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:115:56: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:115:61: Add a return type to the function expression. - export var fnParamArrowVarVariable = (cb = () => 1) => "S"; - - // In Function Variables - No annotations on parameter - export const fnParamExpressionConstVariableOwnerHasReturnType = function foo(cb = function(){ }): number { return 0;} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:119:78: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:119:83: Add a return type to the function expression. - export const fnParamArrowConstVariableOwnerHasReturnType = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:120:61: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:120:66: Add a return type to the function expression. - - export let fnParamExpressionLetVariableOwnerHasReturnType = function foo(cb = function(){ }): number { return 0;} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:122:74: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:122:79: Add a return type to the function expression. - export let fnParamArrowLetVariableOwnerHasReturnType = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:123:57: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:123:62: Add a return type to the function expression. - - export var fnParamExpressionVarVariableOwnerHasReturnType = function foo(cb = function(){ }): number { return 0;} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:125:74: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:125:79: Add a return type to the function expression. - export var fnParamArrowVarVariableOwnerHasReturnType = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:126:57: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:126:62: Add a return type to the function expression. - - // No Errors - export const fnParamExpressionConstVariableOk = function foo(cb = function(): void{ }): number { return 0;} - export const fnParamArrowConstVariableOk = (cb = function(): void{ }): string => "S"; - - export let fnParamExpressionLetVariableOk = function foo(cb = function(): void{ }): number { return 0;} - export let fnParamArrowLetVariableOk = (cb = function(): void{ }): string => "S"; - - export var fnParamExpressionVarVariableOk = function foo(cb = function(): void{ }): number { return 0;} - export var fnParamArrowVarVariableOk = (cb = function(): void{ }): string => "S"; - - export const fnParamExpressionConstVariableInternal = function foo(cb = function(){ }) { return 0;} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:138:68: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:138:73: Add a return type to the function expression. - export const fnParamArrowConstVariableInternal = (cb = () => 1) => "S"; - - export let fnParamExpressionLetVariableInternal = function foo(cb = function(){ }) { return 0;} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:141:64: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:141:69: Add a return type to the function expression. - export let fnParamArrowLetVariableInternal = (cb = () => 1) => "S"; - - export var fnParamExpressionVarVariableInternal = function foo(cb = function(){ }) { return 0;} - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:144:64: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:144:69: Add a return type to the function expression. - export var fnParamArrowVarVariableInternal = (cb = () => 1) => "S"; - - - // In Function Fields - export class FnParamsExportedClass { - // Should Error - fnExpression = function foo(cb = function(){ }) { return 0; } - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:151:33: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:151:38: Add a return type to the function expression. - fnArrow = (cb = function(){ }) => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:152:16: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:152:21: Add a return type to the function expression. - protected fnExpressionProtected = function foo(cb = function(){ }) { return 0; } - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:153:52: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:153:57: Add a return type to the function expression. - protected fnArrowProtected = (cb = function(){ }) => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:154:35: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:154:40: Add a return type to the function expression. - - static fnStaticExpression = function foo(cb = function(){ }) { return 0; } - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:156:46: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:156:51: Add a return type to the function expression. - static fnStaticArrow = (cb = function(){ }) => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:157:29: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:157:34: Add a return type to the function expression. - protected static fnStaticExpressionProtected = function foo(cb = function(){ }) { return 0; } - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:158:65: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:158:70: Add a return type to the function expression. - protected static fnStaticArrowProtected = (cb = function(){ }) => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:159:48: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:159:53: Add a return type to the function expression. - - // Have annotation on owner - fnExpressionMethodHasReturn = function foo(cb = function(){ }): number { return 0; } - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:162:48: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:162:53: Add a return type to the function expression. - fnArrowMethodHasReturn = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:163:31: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:163:36: Add a return type to the function expression. - protected fnExpressionProtectedMethodHasReturn = function foo(cb = function(){ }): number { return 0; } - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:164:67: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:164:72: Add a return type to the function expression. - protected fnArrowProtectedMethodHasReturn = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:165:50: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:165:55: Add a return type to the function expression. - - static fnStaticExpressionMethodHasReturn = function foo(cb = function(){ }): number { return 0; } - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:167:61: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:167:66: Add a return type to the function expression. - static fnStaticArrowMethodHasReturn = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:168:44: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:168:49: Add a return type to the function expression. - protected static fnStaticExpressionProtectedMethodHasReturn = function foo(cb = function(){ }): number { return 0; } - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:169:80: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:169:85: Add a return type to the function expression. - protected static fnStaticArrowProtectedMethodHasReturn = (cb = function(){ }): string => "S"; - ~~~~~~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:170:63: Add a type annotation to the parameter cb. -!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:170:68: Add a return type to the function expression. - - // Have annotation only on parameter - fnExpressionOnlyOnParam = function foo(cb = function(): void { }) { return 0; } - fnArrowOnlyOnParam = (cb = function(): void { }) => "S"; - protected fnExpressionProtectedOnlyOnParam = function foo(cb = function(): void { }) { return 0; } - protected fnArrowProtectedOnlyOnParam = (cb = function(): void { }) => "S"; - - static fnStaticExpressionOnlyOnParam = function foo(cb = function(): void{ }) { return 0; } - static fnStaticArrowOnlyOnParam = (cb = function(): void{ }) => "S"; - protected static fnStaticExpressionProtectedOnlyOnParam = function foo(cb = function(): void{ }) { return 0; } - protected static fnStaticArrowProtectedOnlyOnParam = (cb = function(): void{ }) => "S"; - - // Have annotation, so ok - fnExpressionOk = function foo(cb = function(): void { }): number { return 0; } - fnArrowOK = (cb = function(): void { }): string => "S"; - protected fnExpressionProtectedOk = function foo(cb = function(): void { }): number { return 0; } - protected fnArrowProtectedOK = (cb = function(): void { }): string => "S"; - - static fnStaticExpressionOk = function foo(cb = function(): void{ }): number { return 0; } - static fnStaticArrowOk = (cb = function(): void{ }): string => "S"; - protected static fnStaticExpressionProtectedOk = function foo(cb = function(): void{ }): number { return 0; } - protected static fnStaticArrowProtectedOk = (cb = function(): void{ }): string => "S"; - - - // No Error, not in declarations - private fnExpressionPrivate = function foo(cb = function(){ }) { return 0; } - private fnArrowPrivate = (cb = function(){ }) => "S"; - #fnArrow = (cb = function(){ }) => "S"; - #fnExpression = function foo(cb = function(){ }) { return 0;} - private static fnStaticExpressionPrivate = function foo(cb = function(){ }) { return 0; } - private static fnStaticArrowPrivate = (cb = function(){ }) => "S"; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.errors.txt.diff new file mode 100644 index 00000000000..211aeb1d58e --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.errors.txt.diff @@ -0,0 +1,365 @@ +--- old.isolatedDeclarationErrorsReturnTypes.errors.txt ++++ new.isolatedDeclarationErrorsReturnTypes.errors.txt +@@= skipped -0, +0 lines =@@ +-isolatedDeclarationErrorsReturnTypes.ts(13,45): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(16,41): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(19,41): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(109,65): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(112,61): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(115,61): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(119,83): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(120,66): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(122,79): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(123,62): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(125,79): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(126,62): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(138,73): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(141,69): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(144,69): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(151,38): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(152,21): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(153,57): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(154,40): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(156,51): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(157,34): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(158,70): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(159,53): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(162,53): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(163,36): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(164,72): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(165,55): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(167,66): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(168,49): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(169,85): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-isolatedDeclarationErrorsReturnTypes.ts(170,68): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +- +- +-==== isolatedDeclarationErrorsReturnTypes.ts (31 errors) ==== +- // Function Variables +- export const fnExpressionConstVariable = function foo() { return 0;} +- export const fnArrowConstVariable = () => "S"; +- +- export let fnExpressionLetVariable = function foo() { return 0;} +- export let fnArrowLetVariable = () => "S"; +- +- export var fnExpressionVarVariable = function foo() { return 0;} +- export var fnArrowVarVariable = () => "S"; +- +- // No Errors +- export const fnExpressionConstVariableOk = function foo(): number { return 0;} +- export const fnArrowConstVariableOk = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:13:40: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:13:45: Add a return type to the function expression. +- +- export let fnExpressionLetVariableOk = function foo(): number { return 0;} +- export let fnArrowLetVariableOk = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:16:36: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:16:41: Add a return type to the function expression. +- +- export var fnExpressionVarVariableOk = function foo(): number { return 0;} +- export var fnArrowVarVariableOk = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:19:36: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:19:41: Add a return type to the function expression. +- +- // Not exported +- const fnExpressionConstVariableInternal = function foo() { return 0;} +- const fnArrowConstVariableInternal = () => "S"; +- +- let fnExpressionLetVariableInternal = function foo() { return 0;} +- let fnArrowLetVariableInternal = () => "S"; +- +- var fnExpressionVarVariableInternal = function foo() { return 0;} +- var fnArrowVarVariableInternal = () => "S"; +- +- // Function Fields +- export class ExportedClass { +- // Should Error +- fnExpression = function foo() { return 0; } +- fnArrow = () => "S"; +- protected fnExpressionProtected = function foo() { return 0; } +- protected fnArrowProtected = () => "S"; +- +- static fnStaticExpression = function foo() { return 0; } +- static fnStaticArrow = () => "S"; +- protected static fnStaticExpressionProtected = function foo() { return 0; } +- protected static fnStaticArrowProtected = () => "S"; +- +- // Have annotation, so ok +- fnExpressionOk = function foo(): number { return 0; } +- fnArrowOK = (): string => "S"; +- protected fnExpressionProtectedOk = function foo(): number { return 0; } +- protected fnArrowProtectedOK = (): string => "S"; +- +- static fnStaticExpressionOk = function foo(): number { return 0; } +- static fnStaticArrowOk = (): string => "S"; +- protected static fnStaticExpressionProtectedOk = function foo(): number { return 0; } +- protected static fnStaticArrowProtectedOk = (): string => "S"; +- +- +- // No Error not in declarations +- private fnExpressionPrivate = function foo() { return 0; } +- private fnArrowPrivate = () => "S"; +- #fnArrow = () => "S"; +- #fnExpression = function foo() { return 0;} +- private static fnStaticExpressionPrivate = function foo() { return 0; } +- private static fnStaticArrowPrivate = () => "S"; +- } +- +- // Should error +- class IndirectlyExportedClass { +- fnExpression = function foo() { return 0; } +- fnArrow = () => "S"; +- +- static fnStaticExpression = function foo() { return 0; } +- static fnStaticArrow = () => "S"; +- +- protected static fnStaticExpressionProtected = function foo() { return 0; } +- protected static fnStaticArrowProtected = () => "S"; +- +- private fnExpressionPrivate = function foo() { return 0; } +- private fnArrowPrivate = () => "S"; +- #fnArrow = () => "S"; +- #fnExpression = function foo() { return 0;} +- private static fnStaticExpressionPrivate = function foo() { return 0; } +- private static fnStaticArrowPrivate = () => "S"; +- } +- export const instance: IndirectlyExportedClass = new IndirectlyExportedClass(); +- +- // No Errors +- class InternalClass { +- fnExpression = function foo() { return 0; } +- fnArrow = () => "S"; +- +- static fnStaticExpression = function foo() { return 0; } +- static fnStaticArrow = () => "S"; +- +- protected static fnStaticExpressionProtected = function foo() { return 0; } +- protected static fnStaticArrowProtected = () => "S"; +- +- private fnExpressionPrivate = function foo() { return 0; } +- private fnArrowPrivate = () => "S"; +- #fnArrow = () => "S"; +- #fnExpression = function foo() { return 0;} +- private static fnStaticExpressionPrivate = function foo() { return 0; } +- private static fnStaticArrowPrivate = () => "S"; +- } +- const internalInstance: InternalClass = new InternalClass(); +- +- +- // Function parameters +- +- // In Function Variables - No annotations +- export const fnParamExpressionConstVariable = function foo(cb = function(){ }) { return 0;} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:109:60: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:109:65: Add a return type to the function expression. +- export const fnParamArrowConstVariable = (cb = () => 1) => "S"; +- +- export let fnParamExpressionLetVariable = function foo(cb = function(){ }) { return 0;} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:112:56: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:112:61: Add a return type to the function expression. +- export let fnParamArrowLetVariable = (cb = () => 1) => "S"; +- +- export var fnParamExpressionVarVariable = function foo(cb = function(){ }) { return 0;} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:115:56: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:115:61: Add a return type to the function expression. +- export var fnParamArrowVarVariable = (cb = () => 1) => "S"; +- +- // In Function Variables - No annotations on parameter +- export const fnParamExpressionConstVariableOwnerHasReturnType = function foo(cb = function(){ }): number { return 0;} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:119:78: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:119:83: Add a return type to the function expression. +- export const fnParamArrowConstVariableOwnerHasReturnType = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:120:61: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:120:66: Add a return type to the function expression. +- +- export let fnParamExpressionLetVariableOwnerHasReturnType = function foo(cb = function(){ }): number { return 0;} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:122:74: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:122:79: Add a return type to the function expression. +- export let fnParamArrowLetVariableOwnerHasReturnType = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:123:57: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:123:62: Add a return type to the function expression. +- +- export var fnParamExpressionVarVariableOwnerHasReturnType = function foo(cb = function(){ }): number { return 0;} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:125:74: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:125:79: Add a return type to the function expression. +- export var fnParamArrowVarVariableOwnerHasReturnType = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:126:57: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:126:62: Add a return type to the function expression. +- +- // No Errors +- export const fnParamExpressionConstVariableOk = function foo(cb = function(): void{ }): number { return 0;} +- export const fnParamArrowConstVariableOk = (cb = function(): void{ }): string => "S"; +- +- export let fnParamExpressionLetVariableOk = function foo(cb = function(): void{ }): number { return 0;} +- export let fnParamArrowLetVariableOk = (cb = function(): void{ }): string => "S"; +- +- export var fnParamExpressionVarVariableOk = function foo(cb = function(): void{ }): number { return 0;} +- export var fnParamArrowVarVariableOk = (cb = function(): void{ }): string => "S"; +- +- export const fnParamExpressionConstVariableInternal = function foo(cb = function(){ }) { return 0;} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:138:68: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:138:73: Add a return type to the function expression. +- export const fnParamArrowConstVariableInternal = (cb = () => 1) => "S"; +- +- export let fnParamExpressionLetVariableInternal = function foo(cb = function(){ }) { return 0;} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:141:64: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:141:69: Add a return type to the function expression. +- export let fnParamArrowLetVariableInternal = (cb = () => 1) => "S"; +- +- export var fnParamExpressionVarVariableInternal = function foo(cb = function(){ }) { return 0;} +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:144:64: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:144:69: Add a return type to the function expression. +- export var fnParamArrowVarVariableInternal = (cb = () => 1) => "S"; +- +- +- // In Function Fields +- export class FnParamsExportedClass { +- // Should Error +- fnExpression = function foo(cb = function(){ }) { return 0; } +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:151:33: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:151:38: Add a return type to the function expression. +- fnArrow = (cb = function(){ }) => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:152:16: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:152:21: Add a return type to the function expression. +- protected fnExpressionProtected = function foo(cb = function(){ }) { return 0; } +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:153:52: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:153:57: Add a return type to the function expression. +- protected fnArrowProtected = (cb = function(){ }) => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:154:35: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:154:40: Add a return type to the function expression. +- +- static fnStaticExpression = function foo(cb = function(){ }) { return 0; } +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:156:46: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:156:51: Add a return type to the function expression. +- static fnStaticArrow = (cb = function(){ }) => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:157:29: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:157:34: Add a return type to the function expression. +- protected static fnStaticExpressionProtected = function foo(cb = function(){ }) { return 0; } +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:158:65: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:158:70: Add a return type to the function expression. +- protected static fnStaticArrowProtected = (cb = function(){ }) => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:159:48: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:159:53: Add a return type to the function expression. +- +- // Have annotation on owner +- fnExpressionMethodHasReturn = function foo(cb = function(){ }): number { return 0; } +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:162:48: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:162:53: Add a return type to the function expression. +- fnArrowMethodHasReturn = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:163:31: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:163:36: Add a return type to the function expression. +- protected fnExpressionProtectedMethodHasReturn = function foo(cb = function(){ }): number { return 0; } +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:164:67: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:164:72: Add a return type to the function expression. +- protected fnArrowProtectedMethodHasReturn = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:165:50: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:165:55: Add a return type to the function expression. +- +- static fnStaticExpressionMethodHasReturn = function foo(cb = function(){ }): number { return 0; } +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:167:61: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:167:66: Add a return type to the function expression. +- static fnStaticArrowMethodHasReturn = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:168:44: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:168:49: Add a return type to the function expression. +- protected static fnStaticExpressionProtectedMethodHasReturn = function foo(cb = function(){ }): number { return 0; } +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:169:80: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:169:85: Add a return type to the function expression. +- protected static fnStaticArrowProtectedMethodHasReturn = (cb = function(){ }): string => "S"; +- ~~~~~~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9028 isolatedDeclarationErrorsReturnTypes.ts:170:63: Add a type annotation to the parameter cb. +-!!! related TS9030 isolatedDeclarationErrorsReturnTypes.ts:170:68: Add a return type to the function expression. +- +- // Have annotation only on parameter +- fnExpressionOnlyOnParam = function foo(cb = function(): void { }) { return 0; } +- fnArrowOnlyOnParam = (cb = function(): void { }) => "S"; +- protected fnExpressionProtectedOnlyOnParam = function foo(cb = function(): void { }) { return 0; } +- protected fnArrowProtectedOnlyOnParam = (cb = function(): void { }) => "S"; +- +- static fnStaticExpressionOnlyOnParam = function foo(cb = function(): void{ }) { return 0; } +- static fnStaticArrowOnlyOnParam = (cb = function(): void{ }) => "S"; +- protected static fnStaticExpressionProtectedOnlyOnParam = function foo(cb = function(): void{ }) { return 0; } +- protected static fnStaticArrowProtectedOnlyOnParam = (cb = function(): void{ }) => "S"; +- +- // Have annotation, so ok +- fnExpressionOk = function foo(cb = function(): void { }): number { return 0; } +- fnArrowOK = (cb = function(): void { }): string => "S"; +- protected fnExpressionProtectedOk = function foo(cb = function(): void { }): number { return 0; } +- protected fnArrowProtectedOK = (cb = function(): void { }): string => "S"; +- +- static fnStaticExpressionOk = function foo(cb = function(): void{ }): number { return 0; } +- static fnStaticArrowOk = (cb = function(): void{ }): string => "S"; +- protected static fnStaticExpressionProtectedOk = function foo(cb = function(): void{ }): number { return 0; } +- protected static fnStaticArrowProtectedOk = (cb = function(): void{ }): string => "S"; +- +- +- // No Error, not in declarations +- private fnExpressionPrivate = function foo(cb = function(){ }) { return 0; } +- private fnArrowPrivate = (cb = function(){ }) => "S"; +- #fnArrow = (cb = function(){ }) => "S"; +- #fnExpression = function foo(cb = function(){ }) { return 0;} +- private static fnStaticExpressionPrivate = function foo(cb = function(){ }) { return 0; } +- private static fnStaticArrowPrivate = (cb = function(){ }) => "S"; +- } +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.js b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.js index 8dd9ad0d8a0..b51c38dc6d2 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.js +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.js @@ -361,3 +361,119 @@ export class FnParamsExportedClass { static fnStaticExpressionPrivate = function foo(cb = function () { }) { return 0; }; static fnStaticArrowPrivate = (cb = function () { }) => "S"; } + + +//// [isolatedDeclarationErrorsReturnTypes.d.ts] +export declare const fnExpressionConstVariable: () => number; +export declare const fnArrowConstVariable: () => string; +export declare let fnExpressionLetVariable: () => number; +export declare let fnArrowLetVariable: () => string; +export declare var fnExpressionVarVariable: () => number; +export declare var fnArrowVarVariable: () => string; +export declare const fnExpressionConstVariableOk: () => number; +export declare const fnArrowConstVariableOk: (cb?: () => void) => string; +export declare let fnExpressionLetVariableOk: () => number; +export declare let fnArrowLetVariableOk: (cb?: () => void) => string; +export declare var fnExpressionVarVariableOk: () => number; +export declare var fnArrowVarVariableOk: (cb?: () => void) => string; +export declare class ExportedClass { + #private; + fnExpression: () => number; + fnArrow: () => string; + protected fnExpressionProtected: () => number; + protected fnArrowProtected: () => string; + static fnStaticExpression: () => number; + static fnStaticArrow: () => string; + protected static fnStaticExpressionProtected: () => number; + protected static fnStaticArrowProtected: () => string; + fnExpressionOk: () => number; + fnArrowOK: () => string; + protected fnExpressionProtectedOk: () => number; + protected fnArrowProtectedOK: () => string; + static fnStaticExpressionOk: () => number; + static fnStaticArrowOk: () => string; + protected static fnStaticExpressionProtectedOk: () => number; + protected static fnStaticArrowProtectedOk: () => string; + private fnExpressionPrivate; + private fnArrowPrivate; + private static fnStaticExpressionPrivate; + private static fnStaticArrowPrivate; +} +declare class IndirectlyExportedClass { + #private; + fnExpression: () => number; + fnArrow: () => string; + static fnStaticExpression: () => number; + static fnStaticArrow: () => string; + protected static fnStaticExpressionProtected: () => number; + protected static fnStaticArrowProtected: () => string; + private fnExpressionPrivate; + private fnArrowPrivate; + private static fnStaticExpressionPrivate; + private static fnStaticArrowPrivate; +} +export declare const instance: IndirectlyExportedClass; +export declare const fnParamExpressionConstVariable: (cb?: () => void) => number; +export declare const fnParamArrowConstVariable: (cb?: () => number) => string; +export declare let fnParamExpressionLetVariable: (cb?: () => void) => number; +export declare let fnParamArrowLetVariable: (cb?: () => number) => string; +export declare var fnParamExpressionVarVariable: (cb?: () => void) => number; +export declare var fnParamArrowVarVariable: (cb?: () => number) => string; +export declare const fnParamExpressionConstVariableOwnerHasReturnType: (cb?: () => void) => number; +export declare const fnParamArrowConstVariableOwnerHasReturnType: (cb?: () => void) => string; +export declare let fnParamExpressionLetVariableOwnerHasReturnType: (cb?: () => void) => number; +export declare let fnParamArrowLetVariableOwnerHasReturnType: (cb?: () => void) => string; +export declare var fnParamExpressionVarVariableOwnerHasReturnType: (cb?: () => void) => number; +export declare var fnParamArrowVarVariableOwnerHasReturnType: (cb?: () => void) => string; +export declare const fnParamExpressionConstVariableOk: (cb?: () => void) => number; +export declare const fnParamArrowConstVariableOk: (cb?: () => void) => string; +export declare let fnParamExpressionLetVariableOk: (cb?: () => void) => number; +export declare let fnParamArrowLetVariableOk: (cb?: () => void) => string; +export declare var fnParamExpressionVarVariableOk: (cb?: () => void) => number; +export declare var fnParamArrowVarVariableOk: (cb?: () => void) => string; +export declare const fnParamExpressionConstVariableInternal: (cb?: () => void) => number; +export declare const fnParamArrowConstVariableInternal: (cb?: () => number) => string; +export declare let fnParamExpressionLetVariableInternal: (cb?: () => void) => number; +export declare let fnParamArrowLetVariableInternal: (cb?: () => number) => string; +export declare var fnParamExpressionVarVariableInternal: (cb?: () => void) => number; +export declare var fnParamArrowVarVariableInternal: (cb?: () => number) => string; +export declare class FnParamsExportedClass { + #private; + fnExpression: (cb?: () => void) => number; + fnArrow: (cb?: () => void) => string; + protected fnExpressionProtected: (cb?: () => void) => number; + protected fnArrowProtected: (cb?: () => void) => string; + static fnStaticExpression: (cb?: () => void) => number; + static fnStaticArrow: (cb?: () => void) => string; + protected static fnStaticExpressionProtected: (cb?: () => void) => number; + protected static fnStaticArrowProtected: (cb?: () => void) => string; + fnExpressionMethodHasReturn: (cb?: () => void) => number; + fnArrowMethodHasReturn: (cb?: () => void) => string; + protected fnExpressionProtectedMethodHasReturn: (cb?: () => void) => number; + protected fnArrowProtectedMethodHasReturn: (cb?: () => void) => string; + static fnStaticExpressionMethodHasReturn: (cb?: () => void) => number; + static fnStaticArrowMethodHasReturn: (cb?: () => void) => string; + protected static fnStaticExpressionProtectedMethodHasReturn: (cb?: () => void) => number; + protected static fnStaticArrowProtectedMethodHasReturn: (cb?: () => void) => string; + fnExpressionOnlyOnParam: (cb?: () => void) => number; + fnArrowOnlyOnParam: (cb?: () => void) => string; + protected fnExpressionProtectedOnlyOnParam: (cb?: () => void) => number; + protected fnArrowProtectedOnlyOnParam: (cb?: () => void) => string; + static fnStaticExpressionOnlyOnParam: (cb?: () => void) => number; + static fnStaticArrowOnlyOnParam: (cb?: () => void) => string; + protected static fnStaticExpressionProtectedOnlyOnParam: (cb?: () => void) => number; + protected static fnStaticArrowProtectedOnlyOnParam: (cb?: () => void) => string; + fnExpressionOk: (cb?: () => void) => number; + fnArrowOK: (cb?: () => void) => string; + protected fnExpressionProtectedOk: (cb?: () => void) => number; + protected fnArrowProtectedOK: (cb?: () => void) => string; + static fnStaticExpressionOk: (cb?: () => void) => number; + static fnStaticArrowOk: (cb?: () => void) => string; + protected static fnStaticExpressionProtectedOk: (cb?: () => void) => number; + protected static fnStaticArrowProtectedOk: (cb?: () => void) => string; + private fnExpressionPrivate; + private fnArrowPrivate; + private static fnStaticExpressionPrivate; + private static fnStaticArrowPrivate; +} +export {}; diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.js.diff new file mode 100644 index 00000000000..230a0d1c7ad --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsReturnTypes.js.diff @@ -0,0 +1,122 @@ +--- old.isolatedDeclarationErrorsReturnTypes.js ++++ new.isolatedDeclarationErrorsReturnTypes.js +@@= skipped -360, +360 lines =@@ + static fnStaticExpressionPrivate = function foo(cb = function () { }) { return 0; }; + static fnStaticArrowPrivate = (cb = function () { }) => "S"; + } ++ ++ ++//// [isolatedDeclarationErrorsReturnTypes.d.ts] ++export declare const fnExpressionConstVariable: () => number; ++export declare const fnArrowConstVariable: () => string; ++export declare let fnExpressionLetVariable: () => number; ++export declare let fnArrowLetVariable: () => string; ++export declare var fnExpressionVarVariable: () => number; ++export declare var fnArrowVarVariable: () => string; ++export declare const fnExpressionConstVariableOk: () => number; ++export declare const fnArrowConstVariableOk: (cb?: () => void) => string; ++export declare let fnExpressionLetVariableOk: () => number; ++export declare let fnArrowLetVariableOk: (cb?: () => void) => string; ++export declare var fnExpressionVarVariableOk: () => number; ++export declare var fnArrowVarVariableOk: (cb?: () => void) => string; ++export declare class ExportedClass { ++ #private; ++ fnExpression: () => number; ++ fnArrow: () => string; ++ protected fnExpressionProtected: () => number; ++ protected fnArrowProtected: () => string; ++ static fnStaticExpression: () => number; ++ static fnStaticArrow: () => string; ++ protected static fnStaticExpressionProtected: () => number; ++ protected static fnStaticArrowProtected: () => string; ++ fnExpressionOk: () => number; ++ fnArrowOK: () => string; ++ protected fnExpressionProtectedOk: () => number; ++ protected fnArrowProtectedOK: () => string; ++ static fnStaticExpressionOk: () => number; ++ static fnStaticArrowOk: () => string; ++ protected static fnStaticExpressionProtectedOk: () => number; ++ protected static fnStaticArrowProtectedOk: () => string; ++ private fnExpressionPrivate; ++ private fnArrowPrivate; ++ private static fnStaticExpressionPrivate; ++ private static fnStaticArrowPrivate; ++} ++declare class IndirectlyExportedClass { ++ #private; ++ fnExpression: () => number; ++ fnArrow: () => string; ++ static fnStaticExpression: () => number; ++ static fnStaticArrow: () => string; ++ protected static fnStaticExpressionProtected: () => number; ++ protected static fnStaticArrowProtected: () => string; ++ private fnExpressionPrivate; ++ private fnArrowPrivate; ++ private static fnStaticExpressionPrivate; ++ private static fnStaticArrowPrivate; ++} ++export declare const instance: IndirectlyExportedClass; ++export declare const fnParamExpressionConstVariable: (cb?: () => void) => number; ++export declare const fnParamArrowConstVariable: (cb?: () => number) => string; ++export declare let fnParamExpressionLetVariable: (cb?: () => void) => number; ++export declare let fnParamArrowLetVariable: (cb?: () => number) => string; ++export declare var fnParamExpressionVarVariable: (cb?: () => void) => number; ++export declare var fnParamArrowVarVariable: (cb?: () => number) => string; ++export declare const fnParamExpressionConstVariableOwnerHasReturnType: (cb?: () => void) => number; ++export declare const fnParamArrowConstVariableOwnerHasReturnType: (cb?: () => void) => string; ++export declare let fnParamExpressionLetVariableOwnerHasReturnType: (cb?: () => void) => number; ++export declare let fnParamArrowLetVariableOwnerHasReturnType: (cb?: () => void) => string; ++export declare var fnParamExpressionVarVariableOwnerHasReturnType: (cb?: () => void) => number; ++export declare var fnParamArrowVarVariableOwnerHasReturnType: (cb?: () => void) => string; ++export declare const fnParamExpressionConstVariableOk: (cb?: () => void) => number; ++export declare const fnParamArrowConstVariableOk: (cb?: () => void) => string; ++export declare let fnParamExpressionLetVariableOk: (cb?: () => void) => number; ++export declare let fnParamArrowLetVariableOk: (cb?: () => void) => string; ++export declare var fnParamExpressionVarVariableOk: (cb?: () => void) => number; ++export declare var fnParamArrowVarVariableOk: (cb?: () => void) => string; ++export declare const fnParamExpressionConstVariableInternal: (cb?: () => void) => number; ++export declare const fnParamArrowConstVariableInternal: (cb?: () => number) => string; ++export declare let fnParamExpressionLetVariableInternal: (cb?: () => void) => number; ++export declare let fnParamArrowLetVariableInternal: (cb?: () => number) => string; ++export declare var fnParamExpressionVarVariableInternal: (cb?: () => void) => number; ++export declare var fnParamArrowVarVariableInternal: (cb?: () => number) => string; ++export declare class FnParamsExportedClass { ++ #private; ++ fnExpression: (cb?: () => void) => number; ++ fnArrow: (cb?: () => void) => string; ++ protected fnExpressionProtected: (cb?: () => void) => number; ++ protected fnArrowProtected: (cb?: () => void) => string; ++ static fnStaticExpression: (cb?: () => void) => number; ++ static fnStaticArrow: (cb?: () => void) => string; ++ protected static fnStaticExpressionProtected: (cb?: () => void) => number; ++ protected static fnStaticArrowProtected: (cb?: () => void) => string; ++ fnExpressionMethodHasReturn: (cb?: () => void) => number; ++ fnArrowMethodHasReturn: (cb?: () => void) => string; ++ protected fnExpressionProtectedMethodHasReturn: (cb?: () => void) => number; ++ protected fnArrowProtectedMethodHasReturn: (cb?: () => void) => string; ++ static fnStaticExpressionMethodHasReturn: (cb?: () => void) => number; ++ static fnStaticArrowMethodHasReturn: (cb?: () => void) => string; ++ protected static fnStaticExpressionProtectedMethodHasReturn: (cb?: () => void) => number; ++ protected static fnStaticArrowProtectedMethodHasReturn: (cb?: () => void) => string; ++ fnExpressionOnlyOnParam: (cb?: () => void) => number; ++ fnArrowOnlyOnParam: (cb?: () => void) => string; ++ protected fnExpressionProtectedOnlyOnParam: (cb?: () => void) => number; ++ protected fnArrowProtectedOnlyOnParam: (cb?: () => void) => string; ++ static fnStaticExpressionOnlyOnParam: (cb?: () => void) => number; ++ static fnStaticArrowOnlyOnParam: (cb?: () => void) => string; ++ protected static fnStaticExpressionProtectedOnlyOnParam: (cb?: () => void) => number; ++ protected static fnStaticArrowProtectedOnlyOnParam: (cb?: () => void) => string; ++ fnExpressionOk: (cb?: () => void) => number; ++ fnArrowOK: (cb?: () => void) => string; ++ protected fnExpressionProtectedOk: (cb?: () => void) => number; ++ protected fnArrowProtectedOK: (cb?: () => void) => string; ++ static fnStaticExpressionOk: (cb?: () => void) => number; ++ static fnStaticArrowOk: (cb?: () => void) => string; ++ protected static fnStaticExpressionProtectedOk: (cb?: () => void) => number; ++ protected static fnStaticArrowProtectedOk: (cb?: () => void) => string; ++ private fnExpressionPrivate; ++ private fnArrowPrivate; ++ private static fnStaticExpressionPrivate; ++ private static fnStaticArrowPrivate; ++} ++export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt index 812ec2c1bea..941d9aa3a36 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt @@ -1,4 +1,3 @@ -isolatedDeclarationLazySymbols.ts(1,17): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationLazySymbols.ts(13,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. isolatedDeclarationLazySymbols.ts(16,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. isolatedDeclarationLazySymbols.ts(16,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. @@ -6,11 +5,8 @@ isolatedDeclarationLazySymbols.ts(21,5): error TS9038: Computed property names o isolatedDeclarationLazySymbols.ts(22,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -==== isolatedDeclarationLazySymbols.ts (6 errors) ==== +==== isolatedDeclarationLazySymbols.ts (5 errors) ==== export function foo() { - ~~~ -!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -!!! related TS9031 isolatedDeclarationLazySymbols.ts:1:17: Add a return type to the function declaration. } diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt.diff new file mode 100644 index 00000000000..b22f956dcf4 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt.diff @@ -0,0 +1,20 @@ +--- old.isolatedDeclarationLazySymbols.errors.txt ++++ new.isolatedDeclarationLazySymbols.errors.txt +@@= skipped -0, +0 lines =@@ +-isolatedDeclarationLazySymbols.ts(1,17): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. + isolatedDeclarationLazySymbols.ts(13,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. + isolatedDeclarationLazySymbols.ts(16,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. + isolatedDeclarationLazySymbols.ts(16,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +@@= skipped -5, +4 lines =@@ + isolatedDeclarationLazySymbols.ts(22,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + + +-==== isolatedDeclarationLazySymbols.ts (6 errors) ==== ++==== isolatedDeclarationLazySymbols.ts (5 errors) ==== + export function foo() { +- ~~~ +-!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. +-!!! related TS9031 isolatedDeclarationLazySymbols.ts:1:17: Add a return type to the function declaration. + + } + \ No newline at end of file