diff --git a/tests/baselines/reference/errorsWithCallablesInUnions01.errors.txt b/tests/baselines/reference/errorsWithCallablesInUnions01.errors.txt new file mode 100644 index 00000000000..bf117e0c8b3 --- /dev/null +++ b/tests/baselines/reference/errorsWithCallablesInUnions01.errors.txt @@ -0,0 +1,19 @@ +tests/cases/compiler/errorsWithCallablesInUnions01.ts(10,12): error TS2322: Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn | IDirectivePrePost'. + Type '(x: string) => void' has no properties in common with type 'IDirectivePrePost'. + + +==== tests/cases/compiler/errorsWithCallablesInUnions01.ts (1 errors) ==== + interface IDirectiveLinkFn { + (scope: TScope): void; + } + + interface IDirectivePrePost { + pre?: IDirectiveLinkFn; + post?: IDirectiveLinkFn; + } + + export let blah: IDirectiveLinkFn | IDirectivePrePost = (x: string) => {} + ~~~~ +!!! error TS2322: Type '(x: string) => void' is not assignable to type 'IDirectiveLinkFn | IDirectivePrePost'. +!!! error TS2322: Type '(x: string) => void' has no properties in common with type 'IDirectivePrePost'. + \ No newline at end of file diff --git a/tests/baselines/reference/errorsWithCallablesInUnions01.js b/tests/baselines/reference/errorsWithCallablesInUnions01.js new file mode 100644 index 00000000000..f9ea8041b16 --- /dev/null +++ b/tests/baselines/reference/errorsWithCallablesInUnions01.js @@ -0,0 +1,17 @@ +//// [errorsWithCallablesInUnions01.ts] +interface IDirectiveLinkFn { + (scope: TScope): void; +} + +interface IDirectivePrePost { + pre?: IDirectiveLinkFn; + post?: IDirectiveLinkFn; +} + +export let blah: IDirectiveLinkFn | IDirectivePrePost = (x: string) => {} + + +//// [errorsWithCallablesInUnions01.js] +"use strict"; +exports.__esModule = true; +exports.blah = function (x) { }; diff --git a/tests/baselines/reference/errorsWithCallablesInUnions01.symbols b/tests/baselines/reference/errorsWithCallablesInUnions01.symbols new file mode 100644 index 00000000000..40b48dc2458 --- /dev/null +++ b/tests/baselines/reference/errorsWithCallablesInUnions01.symbols @@ -0,0 +1,31 @@ +=== tests/cases/compiler/errorsWithCallablesInUnions01.ts === +interface IDirectiveLinkFn { +>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 { +>IDirectivePrePost : Symbol(IDirectivePrePost, Decl(errorsWithCallablesInUnions01.ts, 2, 1)) +>TScope : Symbol(TScope, Decl(errorsWithCallablesInUnions01.ts, 4, 28)) + + pre?: IDirectiveLinkFn; +>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; +>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 | IDirectivePrePost = (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)) + diff --git a/tests/baselines/reference/errorsWithCallablesInUnions01.types b/tests/baselines/reference/errorsWithCallablesInUnions01.types new file mode 100644 index 00000000000..492d870b6e4 --- /dev/null +++ b/tests/baselines/reference/errorsWithCallablesInUnions01.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/errorsWithCallablesInUnions01.ts === +interface IDirectiveLinkFn { + (scope: TScope): void; +>scope : TScope +} + +interface IDirectivePrePost { + pre?: IDirectiveLinkFn; +>pre : IDirectiveLinkFn + + post?: IDirectiveLinkFn; +>post : IDirectiveLinkFn +} + +export let blah: IDirectiveLinkFn | IDirectivePrePost = (x: string) => {} +>blah : IDirectiveLinkFn | IDirectivePrePost +>(x: string) => {} : (x: string) => void +>x : string +