-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(deps): updated typescript-eslint
#1425
base: main
Are you sure you want to change the base?
Changes from all commits
4de1629
c810629
816c947
50d27ac
b0f9854
3afa3e3
56c98bd
b716b7f
bbbab49
aaf4a3d
c012cda
b9137c7
9a8708c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,11 +106,12 @@ type Intersect<T> = (T extends unknown ? (x: T) => 0 : never) extends ( | |
*/ | ||
type Unwrap<T> = T extends infer R ? { [K in keyof R]: R[K] } : never; | ||
|
||
type Inputs<I, T extends string> = I extends { [Z in T]: infer K } | ||
? K extends string | ||
? Record<K, (input: I) => unknown> | ||
: never | ||
: never; | ||
type Inputs<I, T extends string> = | ||
I extends Record<T, infer K> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be checked manually. In TS a type and alias to the same type are not the same thing, because they implement aliases as instantations, in C++ way. I'd rather prefer to disable that rule, because it's mostly pointless. |
||
? K extends string | ||
? Record<K, (input: I) => unknown> | ||
: never | ||
: never; | ||
type Outputs<O> = { [K in keyof O]: (input: never) => O[K] }; | ||
type Handlers<I, O, T extends string> = Unwrap<Intersect<Inputs<I, T>>> & | ||
Outputs<O>; | ||
|
@@ -119,7 +120,7 @@ export const makeMakeVisitor = | |
<T extends string>(tag: T) => | ||
<I>() => | ||
<O>(handlers: Handlers<I, O, T>) => | ||
(input: Extract<I, { [K in T]: string }>): O[keyof O] => { | ||
(input: Extract<I, Record<T, string>>): O[keyof O] => { | ||
const handler = (handlers as Record<string, (input: I) => O[keyof O]>)[ | ||
input[tag] | ||
]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
"target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */, | ||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, | ||
"lib": ["ESNext"], | ||
// "allowJs": true, /* Allow javascript files to be compiled. */ | ||
"allowJs": true /* Allow javascript files to be compiled. */, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this? Tact is TS-only project, and |
||
// "checkJs": true, /* Report errors in .js files. */ | ||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ | ||
"declaration": true /* Generates corresponding '.d.ts' file. */, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the error I couldn't beat. As a temporary solution, I suppressed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's completely fine to ignore it here, and you did the right thing.
This "empty" type is a workaround for a buggy implementation of recursive types in TS, and linter has no way to know about it.