-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b13533b
commit e4c78c7
Showing
18 changed files
with
326 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
declare const one: { | ||
(foo: string, bar: string): string; | ||
(foo: number, bar: number): number; | ||
<T>(): T; | ||
}; | ||
|
||
export default one; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports.default = (foo, bar) => { | ||
return foo + bar; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {Observable} from 'rxjs'; | ||
import {expectType} from '../../../..'; | ||
import one from '.'; | ||
|
||
expectType<string>('cat'); | ||
|
||
expectType<string | number>(one('foo', 'bar')); | ||
expectType<string | number>(one(1, 2)); | ||
|
||
expectType<Date | string>(new Date('foo')); | ||
expectType<Promise<number | string>>(new Promise<number>(resolve => resolve(1))); | ||
expectType<Promise<number | string> | string>(new Promise<number | string>(resolve => resolve(1))); | ||
|
||
expectType<Promise<string | number>>(Promise.resolve(1)); | ||
|
||
expectType<Observable<string | number>>( | ||
one<Observable<string>>() | ||
); | ||
|
||
expectType<Observable<string | number> | Observable<string | number | boolean>>( | ||
one<Observable<string | number> | Observable<string>>() | ||
); | ||
|
||
abstract class Foo<T> { | ||
abstract unicorn(): T; | ||
} | ||
|
||
expectType<Foo<string | Foo<string | number>> | Foo<Date> | Foo<Symbol>>( | ||
one<Foo<Date> | Foo<Symbol> | Foo<Foo<number> | string>>() | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "foo", | ||
"dependencies": { | ||
"rxjs": "^6.5.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
declare const one: { | ||
(foo: string, bar: string): string; | ||
(foo: number, bar: number): number; | ||
<T>(): T; | ||
}; | ||
|
||
export default one; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports.default = (foo, bar) => { | ||
return foo + bar; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {Observable} from 'rxjs'; | ||
import {expectType} from '../../../..'; | ||
import one from '.'; | ||
|
||
abstract class Foo<T> { | ||
abstract unicorn(): T; | ||
} | ||
|
||
expectType<string>(one('foo', 'bar')); | ||
expectType<number>(one(1, 2)); | ||
|
||
expectType<Date>(new Date('foo')); | ||
expectType<Promise<number>>(new Promise<number>(resolve => resolve(1))); | ||
expectType<Promise<number | string>>(new Promise<number | string>(resolve => resolve(1))); | ||
|
||
expectType<Promise<number>>(Promise.resolve(1)); | ||
|
||
expectType<Observable<string>>(one<Observable<string>>()); | ||
|
||
expectType<Observable<string | number> | Observable<Date> | Observable<Symbol>>( | ||
one<Observable<Date> | Observable<Symbol> | Observable<number | string>>() | ||
); | ||
|
||
expectType<Foo<string | Foo<string | number>> | Foo<Date> | Foo<Symbol>>( | ||
one<Foo<Date> | Foo<Symbol> | Foo<Foo<number | string> | string>>() | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "foo", | ||
"dependencies": { | ||
"rxjs": "^6.5.3" | ||
} | ||
} |
Oops, something went wrong.