forked from type-challenges/type-challenges
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
14 changed files
with
344 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ignore-workspace-root-check = true |
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 @@ | ||
Implement the built-in `ReturnType<T>` generic without using it. |
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,11 @@ | ||
title: Hello World | ||
|
||
author: | ||
name: Anthony Fu | ||
email: [email protected] | ||
github: antfu | ||
|
||
tsconfig: null | ||
|
||
original_issues: null | ||
recommended_solutions: null |
File renamed without changes.
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,4 @@ | ||
type MyReturnType<T extends Function> = | ||
T extends (...args: any) => infer R | ||
? R | ||
: never |
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,11 @@ | ||
// your code here | ||
|
||
// type MyReturnType<T extends (...args: any) => any> = T | ||
|
||
/* _____________ Test Cases _____________ */ | ||
import { expectType, _ } from '@type-challenges/utils' | ||
|
||
expectType<string>(_ as MyReturnType<() => string>) | ||
expectType<123>(_ as MyReturnType<() => 123>) | ||
expectType<{a: [12, 'foo']; bar: 'hello'}>(_ as MyReturnType<() => {a: [12, 'foo']; bar: 'hello'}>) | ||
expectType<Promise<boolean>>(_ as MyReturnType<() => Promise<boolean>>) |
Empty file.
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
"name": "type-challenges", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"repository": "https://github.com/antfu/type-challenges.git", | ||
"author": "Anthony Fu <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -12,14 +13,28 @@ | |
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config-ts": "^0.2.14", | ||
"@type-challenges/utils": "workspace:*", | ||
"@types/js-yaml": "^3.12.5", | ||
"@types/lz-string": "^1.3.34", | ||
"@types/node": "^14.0.24", | ||
"@typescript-eslint/eslint-plugin": "^3.7.0", | ||
"eslint": "^7.5.0", | ||
"fast-glob": "^3.2.4", | ||
"js-yaml": "^3.14.0", | ||
"lz-string": "^1.4.4", | ||
"rollup": "^2.22.2", | ||
"rollup-plugin-dts": "^1.4.9", | ||
"rollup-plugin-typescript2": "^0.27.1", | ||
"typescript": "^3.9.7", | ||
"@type-challenges/utils": "workspace:*" | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.7" | ||
}, | ||
"eslintConfig": { | ||
"extends": "@antfu/eslint-config-ts" | ||
"extends": "@antfu/eslint-config-ts", | ||
"rules": { | ||
"import/first": "off" | ||
} | ||
}, | ||
"dependencies": { | ||
"utility-types": "^3.10.0" | ||
} | ||
} |
Oops, something went wrong.