Skip to content

Commit 59f7dda

Browse files
committed
Accept new baselines in transpile .d.ts files
1 parent a40c90b commit 59f7dda

3 files changed

Lines changed: 64 additions & 13 deletions

File tree

tests/baselines/reference/transpile/declarationBasicSyntax(declarationMap=false).d.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export interface Foo {
5656
c?: string;
5757
}
5858
//// [class.d.ts] ////
59+
declare const i: unique symbol;
5960
export declare class Bar {
6061
#private;
6162
a: string;
@@ -65,19 +66,25 @@ export declare class Bar {
6566
protected f: string;
6667
private g;
6768
["h"]: string;
69+
[i]: string;
6870
}
6971
export declare abstract class Baz {
7072
abstract a: string;
7173
abstract method(): void;
7274
}
75+
export {};
7376

7477

7578
//// [Diagnostics reported]
76-
class.ts(11,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
79+
class.ts(1,7): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
80+
class.ts(11,6): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
7781

7882

79-
==== class.ts (1 errors) ====
83+
==== class.ts (2 errors) ====
8084
const i = Symbol();
85+
~
86+
!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
87+
!!! related TS9027 class.ts:1:7: Add a type annotation to the variable i.
8188
export class Bar {
8289
a: string;
8390
b?: string;
@@ -88,8 +95,10 @@ class.ts(11,5): error TS9038: Computed property names on class or object literal
8895
private g: string;
8996
["h"]: string;
9097
[i]: string;
91-
~~~
92-
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
98+
~
99+
!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations.
100+
!!! related TS9029 class.ts:11:5: Add a type annotation to the property [i].
101+
!!! related TS9035 class.ts:11:6: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit.
93102
}
94103

95104
export abstract class Baz {

tests/baselines/reference/transpile/declarationBasicSyntax(declarationMap=true).d.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export interface Foo {
6262
//// [interface.d.ts.map] ////
6363
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,CAAC,EAAE,MAAM,CAAC;CACd"}
6464
//// [class.d.ts] ////
65+
declare const i: unique symbol;
6566
export declare class Bar {
6667
#private;
6768
a: string;
@@ -71,22 +72,28 @@ export declare class Bar {
7172
protected f: string;
7273
private g;
7374
["h"]: string;
75+
[i]: string;
7476
}
7577
export declare abstract class Baz {
7678
abstract a: string;
7779
abstract method(): void;
7880
}
81+
export {};
7982
//# sourceMappingURL=class.d.ts.map
8083
//// [class.d.ts.map] ////
81-
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["class.ts"],"names":[],"mappings":"AACA,qBAAa,GAAG;;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACH,CAAC,EAAE,MAAM,CAAC;IAEX,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,CAAC,CAAS;IAClB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CAEjB;AAED,8BAAsB,GAAG;IACrB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,MAAM,IAAI,IAAI;CAC1B"}
84+
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["class.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,CAAC,eAAW,CAAC;AACnB,qBAAa,GAAG;;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACH,CAAC,EAAE,MAAM,CAAC;IAEX,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,CAAC,CAAS;IAClB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;CACf;AAED,8BAAsB,GAAG;IACrB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,MAAM,IAAI,IAAI;CAC1B"}
8285

8386

8487
//// [Diagnostics reported]
85-
class.ts(11,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
88+
class.ts(1,7): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
89+
class.ts(11,6): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
8690

8791

88-
==== class.ts (1 errors) ====
92+
==== class.ts (2 errors) ====
8993
const i = Symbol();
94+
~
95+
!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
96+
!!! related TS9027 class.ts:1:7: Add a type annotation to the variable i.
9097
export class Bar {
9198
a: string;
9299
b?: string;
@@ -97,8 +104,10 @@ class.ts(11,5): error TS9038: Computed property names on class or object literal
97104
private g: string;
98105
["h"]: string;
99106
[i]: string;
100-
~~~
101-
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
107+
~
108+
!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations.
109+
!!! related TS9029 class.ts:11:5: Add a type annotation to the property [i].
110+
!!! related TS9035 class.ts:11:6: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit.
102111
}
103112

104113
export abstract class Baz {

tests/baselines/reference/transpile/declarationComputedPropertyNames.d.ts

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export interface B {
8787
}
8888
export declare class C {
8989
[x: number]: number;
90+
[presentNs.a]: number;
9091
[Symbol.iterator]: number;
9192
[globalThis.Symbol.toStringTag]: number;
9293
[1]: number;
@@ -113,12 +114,18 @@ declarationComputedPropertyNames.ts(27,5): error TS9014: Computed properties mus
113114
declarationComputedPropertyNames.ts(31,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
114115
declarationComputedPropertyNames.ts(32,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
115116
declarationComputedPropertyNames.ts(36,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
117+
declarationComputedPropertyNames.ts(36,6): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
116118
declarationComputedPropertyNames.ts(37,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
117-
declarationComputedPropertyNames.ts(38,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
119+
declarationComputedPropertyNames.ts(37,6): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
120+
declarationComputedPropertyNames.ts(38,6): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
118121
declarationComputedPropertyNames.ts(41,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
122+
declarationComputedPropertyNames.ts(41,6): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
119123
declarationComputedPropertyNames.ts(42,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
124+
declarationComputedPropertyNames.ts(42,6): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
120125
declarationComputedPropertyNames.ts(45,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
126+
declarationComputedPropertyNames.ts(45,6): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
121127
declarationComputedPropertyNames.ts(46,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
128+
declarationComputedPropertyNames.ts(46,6): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
122129
declarationComputedPropertyNames.ts(50,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
123130
declarationComputedPropertyNames.ts(51,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
124131
declarationComputedPropertyNames.ts(52,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
@@ -128,7 +135,7 @@ declarationComputedPropertyNames.ts(59,5): error TS9038: Computed property names
128135
declarationComputedPropertyNames.ts(60,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
129136

130137

131-
==== declarationComputedPropertyNames.ts (22 errors) ====
138+
==== declarationComputedPropertyNames.ts (28 errors) ====
132139
export namespace presentNs {
133140
export const a = Symbol();
134141
~
@@ -185,28 +192,54 @@ declarationComputedPropertyNames.ts(60,5): error TS9038: Computed property names
185192
[missing]: number = 1;
186193
~~~~~~~~~
187194
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
195+
~~~~~~~
196+
!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations.
197+
!!! related TS9029 declarationComputedPropertyNames.ts:36:5: Add a type annotation to the property [missing].
198+
!!! related TS9035 declarationComputedPropertyNames.ts:36:6: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit.
188199
[ns.missing]: number = 1;
189200
~~~~~~~~~~~~
190201
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
202+
~~~~~~~~~~
203+
!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations.
204+
!!! related TS9029 declarationComputedPropertyNames.ts:37:5: Add a type annotation to the property [ns.missing].
205+
!!! related TS9035 declarationComputedPropertyNames.ts:37:6: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit.
191206
[presentNs.a]: number = 1;
192-
~~~~~~~~~~~~~
193-
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
207+
~~~~~~~~~~~
208+
!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations.
209+
!!! related TS9029 declarationComputedPropertyNames.ts:38:5: Add a type annotation to the property [presentNs.a].
210+
!!! related TS9035 declarationComputedPropertyNames.ts:38:6: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit.
194211
[Symbol.iterator]: number = 1;
195212
[globalThis.Symbol.toStringTag]: number = 1;
196213
[(globalThis.Symbol).unscopables]: number = 1;
197214
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
198215
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
216+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
217+
!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations.
218+
!!! related TS9029 declarationComputedPropertyNames.ts:41:5: Add a type annotation to the property [(globalThis.Symbol).unscopables].
219+
!!! related TS9035 declarationComputedPropertyNames.ts:41:6: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit.
199220
[aliasing.isConcatSpreadable]: number = 1;
200221
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
201222
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
223+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
224+
!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations.
225+
!!! related TS9029 declarationComputedPropertyNames.ts:42:5: Add a type annotation to the property [aliasing.isConcatSpreadable].
226+
!!! related TS9035 declarationComputedPropertyNames.ts:42:6: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit.
202227
[1]: number = 1;
203228
["2"]: number = 1;
204229
[(missing2)]: number = 1;
205230
~~~~~~~~~~~~
206231
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
232+
~~~~~~~~~~
233+
!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations.
234+
!!! related TS9029 declarationComputedPropertyNames.ts:45:5: Add a type annotation to the property [(missing2)].
235+
!!! related TS9035 declarationComputedPropertyNames.ts:45:6: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit.
207236
[Math.random() > 0.5 ? "f1" : "f2"]: number = 1;
208237
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209238
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
239+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
240+
!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations.
241+
!!! related TS9029 declarationComputedPropertyNames.ts:46:5: Add a type annotation to the property [Math.random() > 0.5 ? "f1" : "f2"].
242+
!!! related TS9035 declarationComputedPropertyNames.ts:46:6: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit.
210243
}
211244

212245
export const D = {

0 commit comments

Comments
 (0)