Skip to content

Commit

Permalink
chore: build script wip
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 24, 2020
1 parent 386458c commit 169f842
Show file tree
Hide file tree
Showing 14 changed files with 344 additions and 5 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ignore-workspace-root-check = true
1 change: 1 addition & 0 deletions 1-easy/2-return-type/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implement the built-in `ReturnType<T>` generic without using it.
11 changes: 11 additions & 0 deletions 1-easy/2-return-type/info.yml
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.
4 changes: 4 additions & 0 deletions 1-easy/2-return-type/solutions/index.ts
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
11 changes: 11 additions & 0 deletions 1-easy/2-return-type/template.ts
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 added 9-pending/.gitkeep
Empty file.
21 changes: 18 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}
Loading

0 comments on commit 169f842

Please sign in to comment.