Accepted baseleines.

This commit is contained in:
Daniel Rosenwasser
2018-09-04 15:47:04 -07:00
parent 3d812ef93a
commit 289ae3cca6
4 changed files with 86 additions and 0 deletions
@@ -0,0 +1,19 @@
tests/cases/compiler/errorsWithCallablesInUnions01.ts(10,12): error TS2322: Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
Type '(x: string) => void' has no properties in common with type 'IDirectivePrePost<number>'.
==== tests/cases/compiler/errorsWithCallablesInUnions01.ts (1 errors) ====
interface IDirectiveLinkFn<TScope> {
(scope: TScope): void;
}
interface IDirectivePrePost<TScope> {
pre?: IDirectiveLinkFn<TScope>;
post?: IDirectiveLinkFn<TScope>;
}
export let blah: IDirectiveLinkFn<number> | IDirectivePrePost<number> = (x: string) => {}
~~~~
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn<number> | IDirectivePrePost<number>'.
!!! error TS2322: Type '(x: string) => void' has no properties in common with type 'IDirectivePrePost<number>'.
@@ -0,0 +1,17 @@
//// [errorsWithCallablesInUnions01.ts]
interface IDirectiveLinkFn<TScope> {
(scope: TScope): void;
}
interface IDirectivePrePost<TScope> {
pre?: IDirectiveLinkFn<TScope>;
post?: IDirectiveLinkFn<TScope>;
}
export let blah: IDirectiveLinkFn<number> | IDirectivePrePost<number> = (x: string) => {}
//// [errorsWithCallablesInUnions01.js]
"use strict";
exports.__esModule = true;
exports.blah = function (x) { };
@@ -0,0 +1,31 @@
=== tests/cases/compiler/errorsWithCallablesInUnions01.ts ===
interface IDirectiveLinkFn<TScope> {
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithCallablesInUnions01.ts, 0, 0))
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 0, 27))
(scope: TScope): void;
>scope : Symbol(scope, Decl(errorsWithCallablesInUnions01.ts, 1, 5))
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 0, 27))
}
interface IDirectivePrePost<TScope> {
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithCallablesInUnions01.ts, 2, 1))
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 4, 28))
pre?: IDirectiveLinkFn<TScope>;
>pre : Symbol(IDirectivePrePost.pre, Decl(errorsWithCallablesInUnions01.ts, 4, 37))
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithCallablesInUnions01.ts, 0, 0))
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 4, 28))
post?: IDirectiveLinkFn<TScope>;
>post : Symbol(IDirectivePrePost.post, Decl(errorsWithCallablesInUnions01.ts, 5, 35))
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithCallablesInUnions01.ts, 0, 0))
>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 4, 28))
}
export let blah: IDirectiveLinkFn<number> | IDirectivePrePost<number> = (x: string) => {}
>blah : Symbol(blah, Decl(errorsWithCallablesInUnions01.ts, 9, 10))
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithCallablesInUnions01.ts, 0, 0))
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithCallablesInUnions01.ts, 2, 1))
>x : Symbol(x, Decl(errorsWithCallablesInUnions01.ts, 9, 73))
@@ -0,0 +1,19 @@
=== tests/cases/compiler/errorsWithCallablesInUnions01.ts ===
interface IDirectiveLinkFn<TScope> {
(scope: TScope): void;
>scope : TScope
}
interface IDirectivePrePost<TScope> {
pre?: IDirectiveLinkFn<TScope>;
>pre : IDirectiveLinkFn<TScope>
post?: IDirectiveLinkFn<TScope>;
>post : IDirectiveLinkFn<TScope>
}
export let blah: IDirectiveLinkFn<number> | IDirectivePrePost<number> = (x: string) => {}
>blah : IDirectiveLinkFn<number> | IDirectivePrePost<number>
>(x: string) => {} : (x: string) => void
>x : string