-
-
Notifications
You must be signed in to change notification settings - Fork 544
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
Run tsd
in test
script
#162
Conversation
I'm getting no errors locally, I think because of test not including `tsd`, and I don't see where it's run in GitHub Actions, so going to try out in a PR.
@sindresorhus this is an issue - the build above should not be green, unless there's something I'm missing! It looks like the call to I'm going to push a change to re-enable CC @voxpelli |
Update: ok, I turned tsd back on and there are a lot of errors, so I reverted the original bogus change. Most of them look like import errors, I'm guessing from types based on template literals being moved from I tried fixing the imports but got a few other errors to do with types being declared locally but not exported - not sure if this is a tsd issue. I'd be happy to help fix this, but it'd be good to get some guidance on how this is supposed to work. One possible way to fix that IMO would make this less "magical", by using expect-type (disclaimer - I maintain expect-type). Some advantages as I see them:
Let me know if you have a preference between fixing tsd issues, or you'd be open to taking a look at an expect-type port PR. |
tsd
in test
script
Yeah, I disabled |
AFAIK, there are (or at least were) some reasons that |
There are two issues here:
1 can be achieved if we make it so that the tests on individual TS versions happens with a dedicated TS config. |
At first But requirements became more complex. We wanted to support The reason we use the TS API is also because we can detect if something is declared too wide. For instance if you do I hope this somewhat answers the question. If everyone thinks the |
@SamVerschueren Has there been attempts on getting upstream TS to export the needed API:s? |
@voxpelli I had in the past, see this PR microsoft/TypeScript#9943. It's a PR that got stale in 2016! They never did anything with it. You can read my replies at the bottom. There's an open issue to track this microsoft/TypeScript#9879, which is also open from 2016. They never respond... |
@SamVerschueren thanks for the context! Re API readability, it might just be me, I find fluent-style assertions easier to reason about. I've been burned spending a lot of time trying to understand if a test was verifying the wrong thing when assertions look like Re patching TypeScript, it may not be necessary with conditionals anymore. I was able to write expectTypeOf(1).toBeAny() // error
expectTypeOf(1).not.toBeAny() // ok One very clear advantage of patching ts though is that error messages in CI are better, at least until something like microsoft/TypeScript#40468 can be merged enabling customised errors: mmkal/ts#152 |
I'm getting no errors locally, I think because of test not including
tsd
, and I don't see where it's run in GitHub Actions, so going to try out in a PR.Leaving as a draft; feel free to ignore for now - if this goes red then all is well