1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
dissallowSymbolAsWeakType.ts(3,12): error TS2769: No overload matches this call.
Overload 1 of 2, '(iterable: Iterable<object>): WeakSet<object>', gave the following error.
Argument of type 'symbol[]' is not assignable to parameter of type 'Iterable<object>'.
The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
Type 'IteratorResult<symbol, any>' is not assignable to type 'IteratorResult<object, any>'.
Type 'IteratorYieldResult<symbol>' is not assignable to type 'IteratorResult<object, any>'.
Type 'IteratorYieldResult<symbol>' is not assignable to type 'IteratorYieldResult<object>'.
Type 'symbol' is not assignable to type 'object'.
Overload 2 of 2, '(values?: readonly object[]): WeakSet<object>', gave the following error.
Type 'symbol' is not assignable to type 'object'.
dissallowSymbolAsWeakType.ts(4,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(5,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(6,11): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(8,12): error TS2769: No overload matches this call.
Overload 1 of 2, '(iterable: Iterable<readonly [object, boolean]>): WeakMap<object, boolean>', gave the following error.
Argument of type '[symbol, false][]' is not assignable to parameter of type 'Iterable<readonly [object, boolean]>'.
The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
Type 'IteratorResult<[symbol, false], any>' is not assignable to type 'IteratorResult<readonly [object, boolean], any>'.
Type 'IteratorYieldResult<[symbol, false]>' is not assignable to type 'IteratorResult<readonly [object, boolean], any>'.
Type 'IteratorYieldResult<[symbol, false]>' is not assignable to type 'IteratorYieldResult<readonly [object, boolean]>'.
Type '[symbol, false]' is not assignable to type 'readonly [object, boolean]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type 'symbol' is not assignable to type 'object'.
Overload 2 of 2, '(entries?: readonly (readonly [object, boolean])[]): WeakMap<object, boolean>', gave the following error.
Type 'symbol' is not assignable to type 'object'.
dissallowSymbolAsWeakType.ts(9,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(10,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(11,8): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(12,11): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(14,24): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(18,12): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
dissallowSymbolAsWeakType.ts(19,14): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
==== dissallowSymbolAsWeakType.ts (12 errors) ====
const s: symbol = Symbol('s');
const ws = new WeakSet([s]);
~~~~~~~~~~~~~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 2, '(iterable: Iterable<object>): WeakSet<object>', gave the following error.
!!! error TS2769: Argument of type 'symbol[]' is not assignable to parameter of type 'Iterable<object>'.
!!! error TS2769: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
!!! error TS2769: Type 'IteratorResult<symbol, any>' is not assignable to type 'IteratorResult<object, any>'.
!!! error TS2769: Type 'IteratorYieldResult<symbol>' is not assignable to type 'IteratorResult<object, any>'.
!!! error TS2769: Type 'IteratorYieldResult<symbol>' is not assignable to type 'IteratorYieldResult<object>'.
!!! error TS2769: Type 'symbol' is not assignable to type 'object'.
!!! error TS2769: Overload 2 of 2, '(values?: readonly object[]): WeakSet<object>', gave the following error.
!!! error TS2769: Type 'symbol' is not assignable to type 'object'.
ws.add(s);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
ws.has(s);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
ws.delete(s);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
const wm = new WeakMap([[s, false]]);
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769: Overload 1 of 2, '(iterable: Iterable<readonly [object, boolean]>): WeakMap<object, boolean>', gave the following error.
!!! error TS2769: Argument of type '[symbol, false][]' is not assignable to parameter of type 'Iterable<readonly [object, boolean]>'.
!!! error TS2769: The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
!!! error TS2769: Type 'IteratorResult<[symbol, false], any>' is not assignable to type 'IteratorResult<readonly [object, boolean], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[symbol, false]>' is not assignable to type 'IteratorResult<readonly [object, boolean], any>'.
!!! error TS2769: Type 'IteratorYieldResult<[symbol, false]>' is not assignable to type 'IteratorYieldResult<readonly [object, boolean]>'.
!!! error TS2769: Type '[symbol, false]' is not assignable to type 'readonly [object, boolean]'.
!!! error TS2769: Type at position 0 in source is not compatible with type at position 0 in target.
!!! error TS2769: Type 'symbol' is not assignable to type 'object'.
!!! error TS2769: Overload 2 of 2, '(entries?: readonly (readonly [object, boolean])[]): WeakMap<object, boolean>', gave the following error.
!!! error TS2769: Type 'symbol' is not assignable to type 'object'.
wm.set(s, true);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
wm.has(s);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
wm.get(s);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
wm.delete(s);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
const wr = new WeakRef(s);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
wr.deref();
const f = new FinalizationRegistry(() => {});
f.register(s, null);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
f.unregister(s);
~
!!! error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'object'.
|