Skip to content

Commit cee7eb1

Browse files
Accepted baselines.
1 parent d9d5e3a commit cee7eb1

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts(7,10): error TS2394: Overload signature is not compatible with function implementation.
2+
3+
4+
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads05.ts (1 errors) ====
5+
6+
interface Animal { animal: {} };
7+
interface Dog extends Animal { dog: {} }
8+
interface Cat extends Animal { cat: {} }
9+
interface Moose extends Animal { moose: {} }
10+
11+
function doThing(x: "dog"): Dog;
12+
~~~~~~~
13+
!!! error TS2394: Overload signature is not compatible with function implementation.
14+
function doThing(x: "cat"): Cat;
15+
function doThing(x: string): Animal;
16+
function doThing(x: string, y?: string): Moose {
17+
return undefined;
18+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//// [stringLiteralTypesOverloads05.ts]
2+
3+
interface Animal { animal: {} };
4+
interface Dog extends Animal { dog: {} }
5+
interface Cat extends Animal { cat: {} }
6+
interface Moose extends Animal { moose: {} }
7+
8+
function doThing(x: "dog"): Dog;
9+
function doThing(x: "cat"): Cat;
10+
function doThing(x: string): Animal;
11+
function doThing(x: string, y?: string): Moose {
12+
return undefined;
13+
}
14+
15+
//// [stringLiteralTypesOverloads05.js]
16+
;
17+
function doThing(x, y) {
18+
return undefined;
19+
}
20+
21+
22+
//// [stringLiteralTypesOverloads05.d.ts]
23+
interface Animal {
24+
animal: {};
25+
}
26+
interface Dog extends Animal {
27+
dog: {};
28+
}
29+
interface Cat extends Animal {
30+
cat: {};
31+
}
32+
interface Moose extends Animal {
33+
moose: {};
34+
}
35+
declare function doThing(x: "dog"): Dog;
36+
declare function doThing(x: "cat"): Cat;
37+
declare function doThing(x: string): Animal;

0 commit comments

Comments
 (0)