|
| 1 | +```==================== .D.TS ==================== |
| 2 | +
|
| 3 | +// Correct |
| 4 | +export declare const foo: { |
| 5 | + [Symbol.iterator]: () => void; |
| 6 | + [Symbol.asyncIterator]: () => Promise<void>; |
| 7 | + [globalThis.Symbol.iterator]: () => void; |
| 8 | + [Symbol.toStringTag]: string; |
| 9 | +}; |
| 10 | +export declare abstract class Foo { |
| 11 | + [Symbol.iterator](): void; |
| 12 | + [Symbol.asyncIterator](): Promise<void>; |
| 13 | + [globalThis.Symbol.iterator](): void; |
| 14 | + get [Symbol.toStringTag](): string; |
| 15 | +} |
| 16 | +// Incorrect |
| 17 | +export declare namespace Foo { |
| 18 | + const foo: { |
| 19 | + }; |
| 20 | +} |
| 21 | +export declare function bar(Symbol: { |
| 22 | +}, globalThis: { |
| 23 | +}): { |
| 24 | +}; |
| 25 | +
|
| 26 | +
|
| 27 | +==================== Errors ==================== |
| 28 | + x TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. |
| 29 | + ,-[$DIR/tests/fixture/symbol-properties.ts:46:1] |
| 30 | + 45 | export const foo = { |
| 31 | + 46 | [Symbol.iterator]: (): void => {}, |
| 32 | + : ^^^^^^^^^^^^^^^^^ |
| 33 | + 47 | [globalThis.Symbol.iterator]: (): void => {}, |
| 34 | + `---- |
| 35 | + x TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. |
| 36 | + ,-[$DIR/tests/fixture/symbol-properties.ts:47:1] |
| 37 | + 46 | [Symbol.iterator]: (): void => {}, |
| 38 | + 47 | [globalThis.Symbol.iterator]: (): void => {}, |
| 39 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 40 | + 48 | }; |
| 41 | + `---- |
| 42 | + x TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. |
| 43 | + ,-[$DIR/tests/fixture/symbol-properties.ts:53:1] |
| 44 | + 52 | return { |
| 45 | + 53 | [Symbol.iterator]: (): void => {}, |
| 46 | + : ^^^^^^^^^^^^^^^^^ |
| 47 | + 54 | [globalThis.Symbol.iterator]: (): void => {}, |
| 48 | + `---- |
| 49 | + x TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. |
| 50 | + ,-[$DIR/tests/fixture/symbol-properties.ts:54:1] |
| 51 | + 53 | [Symbol.iterator]: (): void => {}, |
| 52 | + 54 | [globalThis.Symbol.iterator]: (): void => {}, |
| 53 | + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 54 | + 55 | }; |
| 55 | + `---- |
| 56 | +
|
| 57 | +
|
| 58 | +``` |
0 commit comments