mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
52 lines
2.3 KiB
Plaintext
52 lines
2.3 KiB
Plaintext
errorElaboration.ts(10,18): error TS2300: Duplicate identifier 'foo'.
|
|
errorElaboration.ts(12,5): error TS2345: Argument of type '() => Container<Ref<string>>' is not assignable to parameter of type '() => Container<Ref<number>>'.
|
|
Type 'Container<Ref<string>>' is not assignable to type 'Container<Ref<number>>'.
|
|
Type 'Ref<string>' is not assignable to type 'Ref<number>'.
|
|
Type 'string' is not assignable to type 'number'.
|
|
errorElaboration.ts(17,11): error TS2322: Type '"bar"' is not assignable to type '"foo"'.
|
|
errorElaboration.ts(22,7): error TS2300: Duplicate identifier 'foo'.
|
|
errorElaboration.ts(23,15): error TS2538: Type 'any' cannot be used as an index type.
|
|
errorElaboration.ts(23,19): error TS2339: Property 'bar' does not exist on type '(x: () => Container<Ref<number>>) => void'.
|
|
|
|
|
|
==== errorElaboration.ts (6 errors) ====
|
|
// Repro for #5712
|
|
|
|
interface Ref<T> {
|
|
prop: T;
|
|
}
|
|
interface Container<T> {
|
|
m1: Container<Ref<T>>;
|
|
m2: T;
|
|
}
|
|
declare function foo(x: () => Container<Ref<number>>): void;
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier 'foo'.
|
|
declare let a: () => Container<Ref<string>>;
|
|
foo(a);
|
|
~
|
|
!!! error TS2345: Argument of type '() => Container<Ref<string>>' is not assignable to parameter of type '() => Container<Ref<number>>'.
|
|
!!! error TS2345: Type 'Container<Ref<string>>' is not assignable to type 'Container<Ref<number>>'.
|
|
!!! error TS2345: Type 'Ref<string>' is not assignable to type 'Ref<number>'.
|
|
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
|
|
|
// Repro for #25498
|
|
|
|
function test(): {[A in "foo"]: A} {
|
|
return {foo: "bar"};
|
|
~~~
|
|
!!! error TS2322: Type '"bar"' is not assignable to type '"foo"'.
|
|
!!! related TS6500 errorElaboration.ts:16:18: The expected type comes from property 'foo' which is declared here on type '{ foo: "foo"; }'
|
|
}
|
|
|
|
// Repro for #32358
|
|
|
|
const foo = { bar: 'a' };
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier 'foo'.
|
|
const x = ({ [foo.bar]: c }) => undefined;
|
|
~~~~~~~
|
|
!!! error TS2538: Type 'any' cannot be used as an index type.
|
|
~~~
|
|
!!! error TS2339: Property 'bar' does not exist on type '(x: () => Container<Ref<number>>) => void'.
|
|
|