-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
circular references in type-helpers.d.ts using tsc 3.4rc #130
Comments
suggested solution: (see: microsoft/TypeScript#30483) export declare type ActionType<ActionCreatorOrMap> = ActionCreatorOrMap extends ActionCreator<StringType> ? ReturnType<ActionCreatorOrMap> : {
1: ActionCreators<ActionCreatorOrMap[keyof ActionCreatorOrMap]>;
0: never;
}[ActionCreatorOrMap extends object ? 1 : 0];
type ActionCreators<T> = T extends any ? ActionType<T> : never; updated/corrected 29.03. |
Were you able to get the proposed solution to work? I still get the circular reference error with typescript@3.2.4 |
Sorry for the incorrect code, I recently only use my phone viewing github. This should be working: export declare type ActionType<ActionCreatorOrMap> = ActionCreatorOrMap extends ActionCreator<StringType> ? ReturnType<ActionCreatorOrMap> : {
1: ActionCreators<ActionCreatorOrMap[keyof ActionCreatorOrMap]>;
0: never;
}[ActionCreatorOrMap extends object ? 1 : 0];
type ActionCreators<T> = T extends any ? ActionType<T> : never; |
@fightingcat that solution is brilliant! I forgot objects were fair game at compile time. TypeScript is pretty neat 👍. Thanks for sharing |
Typescript
Current solution is to revert to |
I'm also running into the same issue @ethanneff is seeing. Looks like TypeScript
|
@fightingcat thanks for the suggested solution it looks good 👍 |
Related TS issues: |
Using tsc 3.4rc a circular reference is detected in type-helpers.d.ts.
tanspiler error message:
_node_modules/typesafe-actions/dist/type-helpers.d.ts
(1,21): Type alias 'ActionType' circularly references itself.
The text was updated successfully, but these errors were encountered: