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

[TS] sample with target: "best common type" problem #247

Closed
bloadvenro opened this issue Nov 15, 2019 · 0 comments · Fixed by #248
Closed

[TS] sample with target: "best common type" problem #247

bloadvenro opened this issue Nov 15, 2019 · 0 comments · Fixed by #248
Labels
typings Typescript public type definitions issues

Comments

@bloadvenro
Copy link
Contributor

bloadvenro commented Nov 15, 2019

sample({
  target: {} as Unit<{ a: string; b: string }>,
  source: {} as Unit<{ a: string }>, // should not let such assignment
  //////////////////////////////////////////////////////////////////////////////
  ///////////////// types of props below do not affect anything ////////////////     
  //////////////////////////////////////////////////////////////////////////////
  clock: {} as Unit<any>,
});

sample({
  target: {} as Unit<{ a: string; b: string }>,
  fn: () => ({ a: '' }), // should not let such assignment
  //////////////////////////////////////////////////////////////////////////////
  ///////////////// types of props below do not affect anything ////////////////     
  //////////////////////////////////////////////////////////////////////////////
  source: {} as Unit<any>,
  clock: {} as Unit<any>,
});

Last time we faced with the same problem in forward typings.

I'll add NoInfer<T> type suggested by Typescript comminuty and modify inference for each sample overload which includes target.

@bloadvenro bloadvenro added the typings Typescript public type definitions issues label Nov 15, 2019
zerobias added a commit that referenced this issue Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typings Typescript public type definitions issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant