Skip to content

Commit 289ae3c

Browse files
Accepted baseleines.
1 parent 3d812ef commit 289ae3c

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
tests/cases/compiler/errorsWithCallablesInUnions01.ts(10,12): error TS2322: Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
2+
Type '(x: string) => void' has no properties in common with type 'IDirectivePrePost<number>'.
3+
4+
5+
==== tests/cases/compiler/errorsWithCallablesInUnions01.ts (1 errors) ====
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> | IDirectivePrePost<number> = (x: string) => {}
16+
~~~~
17+
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
18+
!!! error TS2322: Type '(x: string) => void' has no properties in common with type 'IDirectivePrePost<number>'.
19+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//// [errorsWithCallablesInUnions01.ts]
2+
interface IDirectiveLinkFn<TScope> {
3+
(scope: TScope): void;
4+
}
5+
6+
interface IDirectivePrePost<TScope> {
7+
pre?: IDirectiveLinkFn<TScope>;
8+
post?: IDirectiveLinkFn<TScope>;
9+
}
10+
11+
export let blah: IDirectiveLinkFn<number> | IDirectivePrePost<number> = (x: string) => {}
12+
13+
14+
//// [errorsWithCallablesInUnions01.js]
15+
"use strict";
16+
exports.__esModule = true;
17+
exports.blah = function (x) { };
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
=== tests/cases/compiler/errorsWithCallablesInUnions01.ts ===
2+
interface IDirectiveLinkFn<TScope> {
3+
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithCallablesInUnions01.ts, 0, 0))
4+
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 0, 27))
5+
6+
(scope: TScope): void;
7+
>scope : Symbol(scope, Decl(errorsWithCallablesInUnions01.ts, 1, 5))
8+
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 0, 27))
9+
}
10+
11+
interface IDirectivePrePost<TScope> {
12+
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithCallablesInUnions01.ts, 2, 1))
13+
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 4, 28))
14+
15+
pre?: IDirectiveLinkFn<TScope>;
16+
>pre : Symbol(IDirectivePrePost.pre, Decl(errorsWithCallablesInUnions01.ts, 4, 37))
17+
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithCallablesInUnions01.ts, 0, 0))
18+
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 4, 28))
19+
20+
post?: IDirectiveLinkFn<TScope>;
21+
>post : Symbol(IDirectivePrePost.post, Decl(errorsWithCallablesInUnions01.ts, 5, 35))
22+
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithCallablesInUnions01.ts, 0, 0))
23+
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 4, 28))
24+
}
25+
26+
export let blah: IDirectiveLinkFn<number> | IDirectivePrePost<number> = (x: string) => {}
27+
>blah : Symbol(blah, Decl(errorsWithCallablesInUnions01.ts, 9, 10))
28+
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithCallablesInUnions01.ts, 0, 0))
29+
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithCallablesInUnions01.ts, 2, 1))
30+
>x : Symbol(x, Decl(errorsWithCallablesInUnions01.ts, 9, 73))
31+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=== tests/cases/compiler/errorsWithCallablesInUnions01.ts ===
2+
interface IDirectiveLinkFn<TScope> {
3+
(scope: TScope): void;
4+
>scope : TScope
5+
}
6+
7+
interface IDirectivePrePost<TScope> {
8+
pre?: IDirectiveLinkFn<TScope>;
9+
>pre : IDirectiveLinkFn<TScope>
10+
11+
post?: IDirectiveLinkFn<TScope>;
12+
>post : IDirectiveLinkFn<TScope>
13+
}
14+
15+
export let blah: IDirectiveLinkFn<number> | IDirectivePrePost<number> = (x: string) => {}
16+
>blah : IDirectiveLinkFn<number> | IDirectivePrePost<number>
17+
>(x: string) => {} : (x: string) => void
18+
>x : string
19+

0 commit comments

Comments
 (0)