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

expectError on array arguments mismatch #87

Closed
maximelkin opened this issue Nov 25, 2020 · 1 comment · Fixed by #103
Closed

expectError on array arguments mismatch #87

maximelkin opened this issue Nov 25, 2020 · 1 comment · Fixed by #103
Labels
bug Something isn't working

Comments

@maximelkin
Copy link

maximelkin commented Nov 25, 2020

Following example:

interface A {
  test1(a: '*'): string;
  test1(a: 'a' | 'b'): string;
  test1(a: ReadonlyArray<'a' | 'b'>): string;
  test1(a: never): string;
}
const a: A = null as any;

expectError(a.test1(['a', 'bad']));

No overload matches this call.
  The last overload gave the following error.
    Type string is not assignable to type never.
      Type string is not assignable to type never. 
@maximelkin
Copy link
Author

tsd gives error because test1(...) emits 2 errors for each array item.
Solution is to wrap with expectError() n times where n is errors count

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants