Comments (2)
This has nothing to do with assign
. With setup
API our whole config is the target of inference - inferred type arguments are exempt from excess property check (which is something between a lint rule and a hard error in TS). We can't do anything about it right now - this is how TS works.
from xstate.
I'm such a beginner at typescript, even more so relatively. Why does it catch the following when I remove the actions:
import { setup, assign } from 'xstate';
type Events = { type: 'RUN' };
type Context = {};
setup({
types: {
events: {} as Events,
context: {} as Context,
},
actions: {
doAction: assign(({ context }) => {
return context;
}),
},
}).createMachine({
initial: 'idle',
states: {
idle: {
on: {
RUN: { thing: 'stop' },
},
},
stop: {},
},
});
With Type '{ thing: string; }' is not assignable to type 'TransitionConfigOrTarget<Context, Events, Events, never, { type: "doAction"; params: NonReducibleUnknown; }, never, never, EventObject>'.
from xstate.
Related Issues (20)
- Bug: Spawn and TS error HOT 1
- Bug: typegen.ts ist incomplete when moving state node configs to separate files HOT 3
- Bug: Promise actor error handling doesn't work as documented HOT 3
- Bug: supplying generic input argument to setup actors for stubbing breaks invoke type inference
- Bug: When child state transitioned to final state, did not trigger onDone event and transition to next state
- Bug: [@xstate/store] typings broken HOT 2
- Bug: Bug with After event on restoring snapshot
- Bug: [Typescript] event target doesn't get restricted to declared state HOT 3
- Bug: HOT 3
- Methods like `provide` are lost when implementing Higher Level Actor Logic HOT 1
- Bug: system.get(id) not working after restoring a snapshot HOT 2
- Bug: Importing Xstate in a React-Native android project errors HOT 1
- Bug: History state in parallel machines is changing states unexpectedly HOT 2
- Bug: State entry action's actor value mismatch HOT 9
- Bug: [Typescript] Child actor send method event argument is an intersection of all child actor events
- CreateActor Requires Input with Snapshot
- Bug: @xstate/store does not export any types
- Bug: [Typescript] `enqueueActions` throws a type error when declared within setup actions HOT 2
- `actor.getSnapshot().value` does not contain `compound` state types
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xstate.