Skip to content

Commit d067376

Browse files
Accepted baselines.
1 parent d989e10 commit d067376

8 files changed

+151
-90
lines changed

tests/baselines/reference/errorsWithCallablesInUnions01.errors.txt

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/baselines/reference/errorsWithCallablesInUnions01.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/baselines/reference/errorsWithCallablesInUnions01.symbols

Lines changed: 0 additions & 31 deletions
This file was deleted.

tests/baselines/reference/errorsWithCallablesInUnions01.types

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
tests/cases/compiler/errorsWithInvokablesInUnions01.ts(14,12): error TS2322: Type '(x: string) => void' is not assignable to type 'ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
2+
Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn<number>'.
3+
Types of parameters 'x' and 'scope' are incompatible.
4+
Type 'number' is not assignable to type 'string'.
5+
tests/cases/compiler/errorsWithInvokablesInUnions01.ts(16,12): error TS2322: Type 'typeof ctor' is not assignable to type 'ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
6+
Type 'typeof ctor' is not assignable to type 'ConstructableA'.
7+
Type 'ctor' is not assignable to type '{ somePropA: any; }'.
8+
Property 'somePropA' is missing in type 'ctor'.
9+
10+
11+
==== tests/cases/compiler/errorsWithInvokablesInUnions01.ts (2 errors) ====
12+
interface ConstructableA {
13+
new(): { somePropA: any };
14+
}
15+
16+
interface IDirectiveLinkFn<TScope> {
17+
(scope: TScope): void;
18+
}
19+
20+
interface IDirectivePrePost<TScope> {
21+
pre?: IDirectiveLinkFn<TScope>;
22+
post?: IDirectiveLinkFn<TScope>;
23+
}
24+
25+
export let blah: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = (x: string) => {}
26+
~~~~
27+
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
28+
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn<number>'.
29+
!!! error TS2322: Types of parameters 'x' and 'scope' are incompatible.
30+
!!! error TS2322: Type 'number' is not assignable to type 'string'.
31+
32+
export let ctor: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = class {
33+
~~~~
34+
!!! error TS2322: Type 'typeof ctor' is not assignable to type 'ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
35+
!!! error TS2322: Type 'typeof ctor' is not assignable to type 'ConstructableA'.
36+
!!! error TS2322: Type 'ctor' is not assignable to type '{ somePropA: any; }'.
37+
!!! error TS2322: Property 'somePropA' is missing in type 'ctor'.
38+
someUnaccountedProp: any;
39+
}
40+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//// [errorsWithInvokablesInUnions01.ts]
2+
interface ConstructableA {
3+
new(): { somePropA: any };
4+
}
5+
6+
interface IDirectiveLinkFn<TScope> {
7+
(scope: TScope): void;
8+
}
9+
10+
interface IDirectivePrePost<TScope> {
11+
pre?: IDirectiveLinkFn<TScope>;
12+
post?: IDirectiveLinkFn<TScope>;
13+
}
14+
15+
export let blah: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = (x: string) => {}
16+
17+
export let ctor: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = class {
18+
someUnaccountedProp: any;
19+
}
20+
21+
22+
//// [errorsWithInvokablesInUnions01.js]
23+
"use strict";
24+
exports.__esModule = true;
25+
exports.blah = function (x) { };
26+
exports.ctor = /** @class */ (function () {
27+
function class_1() {
28+
}
29+
return class_1;
30+
}());
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
=== tests/cases/compiler/errorsWithInvokablesInUnions01.ts ===
2+
interface ConstructableA {
3+
>ConstructableA : Symbol(ConstructableA, Decl(errorsWithInvokablesInUnions01.ts, 0, 0))
4+
5+
new(): { somePropA: any };
6+
>somePropA : Symbol(somePropA, Decl(errorsWithInvokablesInUnions01.ts, 1, 10))
7+
}
8+
9+
interface IDirectiveLinkFn<TScope> {
10+
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
11+
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 4, 27))
12+
13+
(scope: TScope): void;
14+
>scope : Symbol(scope, Decl(errorsWithInvokablesInUnions01.ts, 5, 5))
15+
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 4, 27))
16+
}
17+
18+
interface IDirectivePrePost<TScope> {
19+
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithInvokablesInUnions01.ts, 6, 1))
20+
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 8, 28))
21+
22+
pre?: IDirectiveLinkFn<TScope>;
23+
>pre : Symbol(IDirectivePrePost.pre, Decl(errorsWithInvokablesInUnions01.ts, 8, 37))
24+
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
25+
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 8, 28))
26+
27+
post?: IDirectiveLinkFn<TScope>;
28+
>post : Symbol(IDirectivePrePost.post, Decl(errorsWithInvokablesInUnions01.ts, 9, 35))
29+
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
30+
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 8, 28))
31+
}
32+
33+
export let blah: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = (x: string) => {}
34+
>blah : Symbol(blah, Decl(errorsWithInvokablesInUnions01.ts, 13, 10))
35+
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
36+
>ConstructableA : Symbol(ConstructableA, Decl(errorsWithInvokablesInUnions01.ts, 0, 0))
37+
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithInvokablesInUnions01.ts, 6, 1))
38+
>x : Symbol(x, Decl(errorsWithInvokablesInUnions01.ts, 13, 90))
39+
40+
export let ctor: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = class {
41+
>ctor : Symbol(ctor, Decl(errorsWithInvokablesInUnions01.ts, 15, 10))
42+
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
43+
>ConstructableA : Symbol(ConstructableA, Decl(errorsWithInvokablesInUnions01.ts, 0, 0))
44+
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithInvokablesInUnions01.ts, 6, 1))
45+
46+
someUnaccountedProp: any;
47+
>someUnaccountedProp : Symbol(ctor.someUnaccountedProp, Decl(errorsWithInvokablesInUnions01.ts, 15, 96))
48+
}
49+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
=== tests/cases/compiler/errorsWithInvokablesInUnions01.ts ===
2+
interface ConstructableA {
3+
new(): { somePropA: any };
4+
>somePropA : any
5+
}
6+
7+
interface IDirectiveLinkFn<TScope> {
8+
(scope: TScope): void;
9+
>scope : TScope
10+
}
11+
12+
interface IDirectivePrePost<TScope> {
13+
pre?: IDirectiveLinkFn<TScope>;
14+
>pre : IDirectiveLinkFn<TScope>
15+
16+
post?: IDirectiveLinkFn<TScope>;
17+
>post : IDirectiveLinkFn<TScope>
18+
}
19+
20+
export let blah: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = (x: string) => {}
21+
>blah : ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>
22+
>(x: string) => {} : (x: string) => void
23+
>x : string
24+
25+
export let ctor: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = class {
26+
>ctor : ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>
27+
>class { someUnaccountedProp: any;} : typeof ctor
28+
29+
someUnaccountedProp: any;
30+
>someUnaccountedProp : any
31+
}
32+

0 commit comments

Comments
 (0)