-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Migrate more type tests to TSTyche #1989
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
Conversation
// TODO: Turn on once https://github.com/Microsoft/dtslint/issues/19 is resolved. | ||
Range; // $ ExpectType (start?: number | undefined, end?: number | undefined, step?: number | undefined) => Indexed<number> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice that few assertions were disabled by adding a space: // $ ExpectType
instead of // $ExpectType
. I think now they work as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Range did change in 5.x in that way yes 😉
One question. I work on // $ExpectError
List().size = 10;
// $ExpectError
Map().size = 10; This makes sure that expect(List()).type.toMatch<{ readonly size: number }>();
expect(Map()).type.toMatch<{ readonly size: number }>(); Somewhat better, but still indirect. Here is new idea: expect(List().size).type.toBeReadonly();
expect(Map().size).type.toBeReadonly(); UPDATE: it is not so simple. I mean, Easy to read (and to implement). @jdeniau What you think? |
// $ExpectType boolean | ||
has({ x: 10, y: 20 }, 'x'); | ||
} | ||
expect(set([1, 2, 3], 0, 'a')).type.toRaiseError(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and elsewhere .not.toBeCallableWith()
matcher should be used instead of .toRaiseError()
. Keeping it as it was, but I will come back after implementing .toBeCallableWith()
:
expect(set).type.not.toBeCallableWith([1, 2, 3], 0, 'a');
expect(List().size).type.toBeReadonly(); seems easy to read, so it's a 👍 for me |
Thanks for heads up regarding If all looks good here, this PR can be merged. |
Unrelated failing tests (error in |
Following up #1988
This PR migrates more type tests to TSTyche.