-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Compilation issues with Typescript v3.8.2 & xstate v4.6.7 #1015
Comments
Is it possible to upgrade XState? |
typescript v3.8.2 |
It's difficult to know what the issue is without seeing a reproducible code example, please |
Dependencies in package.json file:
tsconfig.ts file: {
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2016",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./src"
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
} The error leads to this line 17 in interpreter.d.ts export declare class Interpreter<TContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = any> implements Actor<State<TContext, TEvent>, TEvent> { |
This is not a repro case though - to investigate we need to have a runnable, complete, repro case |
Hi all! I'm running into the same TypeScript compilation error as @Khaled-Ch. Here's my dependency versions per "@xstate/react": "^0.8.1",
"antd": "^4.0.0-rc.5",
"next": "^9.2.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"styled-components": "^5.0.1",
"xstate": "^4.7.8" I've pushed this up to a CodeSandbox, but I haven't used their server-side templates much. Hopefully it's functional for everyone! https://codesandbox.io/s/github/kpollich/hangman I've also pushed the code up to GitHub here: https://codesandbox.io/s/github/kpollich/hangman The actual error output looks like this, and comes up during Next's TypeScript compilation I think:
I've only just started playing with |
Bug with xstate currently on newer versions Follow on statelyai/xstate#1015
Bug with xstate currently on newer versions Follow on statelyai/xstate#1015
@kpollich @Khaled-Ch Can you please try with |
For me solved by adding this to my tsconfig.json |
@davidkpiano Updating to |
I'm also getting this error and updating to Update --> I can confirm that updating both |
@davidalekna Just an FYI, I'm running
|
A follow up; downgrading from |
Hey all 👋 I have the same issue with The exact error is:
It seems to be an issue with TypeScript itself? microsoft/TypeScript#34933 |
I also got the
Edit: Nevermind, no error was thrown only on the first compilation. Got the same error when making changes in watch mode. Going to downgrade TypeScript now 😬 |
I am having the same problem as well, tried: skiplibcheck and update to @next version. Still not working, I am hesitant to downgrade the typescript, any other workaround I've missed until it's fully fixed? |
Tried a simple state machine from the Intro to Xstate Egghead.io course as a sanity check import {Machine} from 'xstate';
export const stopLightMachine = Machine({
id: 'stopLight',
initial: 'red',
states: {
red: {
after: { 4000: 'yellow' },
},
yellow: {
after: { 1000: 'green' },
},
green: {
after: { 3000: 'red' },
},
},
}); Tried hooking it up in the middle of creating a simple demo of it working or not only to get the import {LitElement, html, css, property, customElement, query} from 'lit-element';
import {classMap} from 'lit-html/directives/class-map';
import {stopLightMachine} from "./machines/stop-light"
import {interpret} from 'xstate'
@customElement('my-element')
class MyElement extends LitElement {
service: any;
state: any;
static get styles() {
return [
css`
p.red {
color: red;
}
p.green {
color: green;
}
p.yellow: {
color: yellow;
}
`
];
}
connectedCallback(){
super.connectedCallback()
console.log('Yoooo')
// Error occurs
this.service = interpret(stopLightMachine).start()
}
render() {
return html`<p class=${classMap({red: true, green: true, yellow: true})}>???</p>`
}
} The TSConfig used {
"compilerOptions": {
"target": "es2017",
"module": "es2015",
"moduleResolution": "node",
"lib": ["es2017", "dom"],
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"strict": false,
"outDir": "./",
"skipLibCheck": true,
"noImplicitAny": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true
},
"include": [
"**/*"
],
"exclude": [
"node_modules"
]
} @davidkpiano Example glitch this occurs (Node 8 & 12 was used): https://glitch.com/edit/#!/abundant-outrageous-neighborhood?path=my-element.ts:36:54 |
It's a known issue in TypeScript @lozandier. You need to downgrade your version to make it work for the moment. |
@RomainLanz Tried downgrading all the way to TypeScript 3.5 w/ no luck Update: Using |
I'm getting this same issue with:
|
Same issue here 👋
|
Please try |
I confirm this is fixed on my application! Thanks! 🎉 |
@RomainLanz Thanks for confirming!! |
Can confirm fixed on mine as well. Thanks! |
I am using xstate version 4.6.7 and typescript version 3.8.2.
I am having the following issue during the compilation process of my project.
node_modules/xstate/lib/interpreter.d.ts:17:22 - error TS2589: Type instantiation is excessively deep and possibly infinite.
export declare class Interpreter<TContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = any> implements Actor<State<TContext, TEvent>, TEvent>
The text was updated successfully, but these errors were encountered: