Skip to content
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

types.union type inference is wrong #1391

Closed
3 tasks done
skeate opened this issue Sep 17, 2019 · 3 comments
Closed
3 tasks done

types.union type inference is wrong #1391

skeate opened this issue Sep 17, 2019 · 3 comments
Labels
bug Confirmed bug Typescript Issue related to Typescript typings

Comments

@skeate
Copy link

skeate commented Sep 17, 2019

Bug report

  • I've checked documentation and searched for existing issues
  • I've made sure my project is based on the latest MST version
  • Fork this code sandbox or another minimal reproduction.

Sandbox link or minimal reproduction code
https://codesandbox.io/s/cool-neumann-gd521

Describe the expected behavior
When creating instance, the property item should accept string, number, or null.

Describe the observed behavior
TS error, item only accepts null.

@xaviergonz xaviergonz added bug Confirmed bug Typescript Issue related to Typescript typings labels Sep 21, 2019
@xaviergonz
Copy link
Contributor

Might be related to #1371

@mweststrate
Copy link
Member

This is conceptually correct, for reasons explained here: #1403 (comment). In other words, never redeclare property types, except if you can subtime them

@lock
Copy link

lock bot commented Jan 14, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug Typescript Issue related to Typescript typings
Projects
None yet
Development

No branches or pull requests

3 participants