Replies: 1 comment 1 reply
-
|
Hey @Lao-Ax - unfortunately I don't think we have a way to configure this at runtime. It's just how enums work in MST. I think you should get the TS completions you want if you make a custom type here, like this: const TaskMode = t.union(
t.enumeration(['AAA', 'BBB']),
t.string
)
const TaskStore = t.model('TaskStore', {
id: t.identifier,
mode: TaskMode,
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to not throw an exception for enumerations when types is not a part of enum?
Example:
Imagine that I got a
Taskby server. And eventually it returns{mode: 'CCC'}. MST throws an exceptionNo type is applicable for the union.I do not want runtime errors in that place. I'm OK that the
taskhas a newmode, I will code it soon. But now I want my users be able to do stuff with tasks as before. :)AND I want to save in place IDE suggestions about types, until I added a new one.
Is there any way to disable that strict type checking for enums by config? Or other ways?
Beta Was this translation helpful? Give feedback.
All reactions