-
Notifications
You must be signed in to change notification settings - Fork 42
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
[TypeScript] typegen creating output which conflicts with @typescript-eslint/ban-types #411
Comments
I'm currently working around this with an override in my eslint.json to disable that rule for |
@mattpocock we can probably just output |
Yes, although applying any linting whatsoever to generated files is probably not a great idea. When we release the CLI, we'll even be able to gitignore these assets and generate them on CI. This is a cheap enough change to make, though. |
@mattpocock Is there any example on how to do this on GH Actions? thanks in advance! |
@horacioh Yes, see the CLI docs: |
YES!! I saw it and forgot to mention it here ;) |
HI all ! I'm having the same issue - toying around with a pretty simple machine that typegens this: export interface Typegen0 {
"@@xstate/typegen": true;
internalEvents: {
"xstate.init": { type: "xstate.init" };
"xstate.stop": { type: "xstate.stop" };
};
invokeSrcNameMap: {};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
logEntry: "PLAY" | "STOP";
logExit: "PAUSE" | "STOP" | "xstate.stop";
logPaused: "PAUSE";
};
eventsCausingDelays: {};
eventsCausingGuards: {};
eventsCausingServices: {};
matchesStates: "paused" | "playing" | "stopped";
tags: never;
} And the warnings as similar to what is described above
So what is the recommended way to handle this ? Add typegen files to eslintignore ? Thanks |
Yes, this is a reasonable approach. I will probably look in the future for alternative approaches for this but the mentioned ESLint rule shouldn't always be blindly trusted anyway. There are some cases for which |
Description
Typegen output is offending
@typescript-eslint/ban-types
whose mission statement is-- README
Expected Result
Typegen output should not use incorrect types which are flagged by the
@typescript-eslint/ban-types
ruleActual Result
The specific error is:
And can occur on
invokeSrcNameMap
,eventsCausingServices
,eventsCausingGuards
, andeventsCausingDelays
:Reproduction
Typegen doesn't run on codesandbox, but the following machine will trigger the above error on
[email protected]
:Additional context
XState 4.29.0
statelyai.stately-vscode 1.5.6
The text was updated successfully, but these errors were encountered: