Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2018-09-05 15:12:23 -07:00
parent d989e10c49
commit d0673762f1
8 changed files with 151 additions and 90 deletions

View file

@ -1,23 +0,0 @@
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' is not assignable to type 'IDirectiveLinkFn<number>'.
Types of parameters 'x' and 'scope' are incompatible.
Type 'number' is not assignable to type 'string'.
==== 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' 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'.

View file

@ -1,17 +0,0 @@
//// [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) { };

View file

@ -1,31 +0,0 @@
=== 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))

View file

@ -1,19 +0,0 @@
=== 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

View file

@ -0,0 +1,40 @@
tests/cases/compiler/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'.
tests/cases/compiler/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'.
Type 'ctor' is not assignable to type '{ somePropA: any; }'.
Property 'somePropA' is missing in type 'ctor'.
==== tests/cases/compiler/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: Type 'ctor' is not assignable to type '{ somePropA: any; }'.
!!! error TS2322: Property 'somePropA' is missing in type 'ctor'.
someUnaccountedProp: any;
}

View file

@ -0,0 +1,30 @@
//// [errorsWithInvokablesInUnions01.ts]
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) => {}
export let ctor: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = class {
someUnaccountedProp: any;
}
//// [errorsWithInvokablesInUnions01.js]
"use strict";
exports.__esModule = true;
exports.blah = function (x) { };
exports.ctor = /** @class */ (function () {
function class_1() {
}
return class_1;
}());

View file

@ -0,0 +1,49 @@
=== tests/cases/compiler/errorsWithInvokablesInUnions01.ts ===
interface ConstructableA {
>ConstructableA : Symbol(ConstructableA, Decl(errorsWithInvokablesInUnions01.ts, 0, 0))
new(): { somePropA: any };
>somePropA : Symbol(somePropA, Decl(errorsWithInvokablesInUnions01.ts, 1, 10))
}
interface IDirectiveLinkFn<TScope> {
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 4, 27))
(scope: TScope): void;
>scope : Symbol(scope, Decl(errorsWithInvokablesInUnions01.ts, 5, 5))
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 4, 27))
}
interface IDirectivePrePost<TScope> {
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithInvokablesInUnions01.ts, 6, 1))
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 8, 28))
pre?: IDirectiveLinkFn<TScope>;
>pre : Symbol(IDirectivePrePost.pre, Decl(errorsWithInvokablesInUnions01.ts, 8, 37))
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 8, 28))
post?: IDirectiveLinkFn<TScope>;
>post : Symbol(IDirectivePrePost.post, Decl(errorsWithInvokablesInUnions01.ts, 9, 35))
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
>TScope : Symbol(TScope, Decl(errorsWithInvokablesInUnions01.ts, 8, 28))
}
export let blah: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = (x: string) => {}
>blah : Symbol(blah, Decl(errorsWithInvokablesInUnions01.ts, 13, 10))
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
>ConstructableA : Symbol(ConstructableA, Decl(errorsWithInvokablesInUnions01.ts, 0, 0))
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithInvokablesInUnions01.ts, 6, 1))
>x : Symbol(x, Decl(errorsWithInvokablesInUnions01.ts, 13, 90))
export let ctor: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = class {
>ctor : Symbol(ctor, Decl(errorsWithInvokablesInUnions01.ts, 15, 10))
>IDirectiveLinkFn : Symbol(IDirectiveLinkFn, Decl(errorsWithInvokablesInUnions01.ts, 2, 1))
>ConstructableA : Symbol(ConstructableA, Decl(errorsWithInvokablesInUnions01.ts, 0, 0))
>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithInvokablesInUnions01.ts, 6, 1))
someUnaccountedProp: any;
>someUnaccountedProp : Symbol(ctor.someUnaccountedProp, Decl(errorsWithInvokablesInUnions01.ts, 15, 96))
}

View file

@ -0,0 +1,32 @@
=== tests/cases/compiler/errorsWithInvokablesInUnions01.ts ===
interface ConstructableA {
new(): { somePropA: any };
>somePropA : any
}
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> | ConstructableA | IDirectivePrePost<number> = (x: string) => {}
>blah : ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>
>(x: string) => {} : (x: string) => void
>x : string
export let ctor: IDirectiveLinkFn<number> | ConstructableA | IDirectivePrePost<number> = class {
>ctor : ConstructableA | IDirectiveLinkFn<number> | IDirectivePrePost<number>
>class { someUnaccountedProp: any;} : typeof ctor
someUnaccountedProp: any;
>someUnaccountedProp : any
}