mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
39 lines
2.2 KiB
Plaintext
39 lines
2.2 KiB
Plaintext
errorsWithInvokablesInUnions01.ts(14,12): error TS2322: Type '(x: string) => void' is not assignable to type 'ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
|
|
Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn<number>'.
|
|
Types of parameters 'x' and 'scope' are incompatible.
|
|
Type 'number' is not assignable to type 'string'.
|
|
errorsWithInvokablesInUnions01.ts(16,12): error TS2322: Type 'typeof ctor' is not assignable to type 'ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
|
|
Type 'typeof ctor' is not assignable to type 'ConstructableA'.
|
|
Property 'somePropA' is missing in type 'ctor' but required in type '{ somePropA: any; }'.
|
|
|
|
|
|
==== errorsWithInvokablesInUnions01.ts (2 errors) ====
|
|
interface ConstructableA {
|
|
new(): { somePropA: any };
|
|
}
|
|
|
|
interface IDirectiveLinkFn<TScope> {
|
|
(scope: TScope): void;
|
|
}
|
|
|
|
interface IDirectivePrePost<TScope> {
|
|
pre?: IDirectiveLinkFn<TScope>;
|
|
post?: IDirectiveLinkFn<TScope>;
|
|
}
|
|
|
|
export let blah: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = (x: string) => {}
|
|
~~~~
|
|
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
|
|
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn<number>'.
|
|
!!! error TS2322: Types of parameters 'x' and 'scope' are incompatible.
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
|
|
export let ctor: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = class {
|
|
~~~~
|
|
!!! error TS2322: Type 'typeof ctor' is not assignable to type 'ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
|
|
!!! error TS2322: Type 'typeof ctor' is not assignable to type 'ConstructableA'.
|
|
!!! error TS2322: Property 'somePropA' is missing in type 'ctor' but required in type '{ somePropA: any; }'.
|
|
!!! related TS2728 errorsWithInvokablesInUnions01.ts:2:12: 'somePropA' is declared here.
|
|
someUnaccountedProp: any;
|
|
}
|
|
|