-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Allow testing another TypeScript version #47
Comments
Which two private methods do you need? I think it’d be a better idea to file a feature request on the TypeScript repository, rather than maintaining your own fork. |
Read from here to the bottom. You can't say I didn't try. It's a PR of 2016. |
Definitely would like to see this feature, this is one of the main things we're looking to test. Would it also take into account |
The idea would be to be able to set |
While I don't need this personally, I can see how it can be useful for some projects. However, I don't think you should bundle TypeScript versions. The default should also stay, that |
Yes, while bundling is the easiest solution, I don't want to do it either so I will explore the dynamic path. I agree that the default should always be the latest minor version, 3.7 at the moment. |
Couldn't you release all minor TypeScript-versions as separate patched packages? |
What about |
Although releasing a custom typescript version might be a good idea, I don't think I would be able to keep up with releasing patches etc. That path would be easier to do though then dynamically downloading a certain version, inserting code dynamically and running the tests... Although the latter would be much more maintainable from my side. |
@ SamVerschueren would it help if I scripted a CI pipeline that would auto-release those packages using github actions or travis? |
How is this done in tslint? I saw they can check against multiple typescript versions. I'm also not going to use this feature in near future, but see this as very interesting and helpful, especially in a long run. |
@SamVerschueren I was a little bored and followed up on my idea of automating this - take a look over here: https://github.com/phryneas/testable-ts/commit/6baa0ef9493e4f8ee5578f12f9081cd65639af50/checks?check_suite_id=373940820 Essentially, the repo has a github action that adds the I explicitly chose the path of multiple versions as package names, as this will make it easier to install multiple of those in parallel - the The whole thing is pretty low-maintenance - running The only thing I haven't done yet is actually publishing those packages to npm, currently they are only available as Artifact download from the github action. Would love to hear your feedback (and if you need any additional methods exposed) before I take that step :) |
Okay, now they're already published as |
Could you make the TypeScript version |
This feature would extremely useful, especially given that TypeScritp drop breaking changes in minor releases, which makes it hard to be sure that a feature works well in different versions. |
@SamVerschueren I've just found this package, and by its description, it looks like it could help with this issue, what do you think? |
We're looking at the space for how we can validate our types across the Ember ecosystem, and while I'd prefer to use tsd, this issue is basically a hard blocker for us: one of our core constraints is that we need to be able to test published types against different versions of TS, so that we can maintain Ember's strong backwards-compatibility guarantees. I have bandwidth and can help dig in if there's interest in changing this! Related: microsoft/dtslint#284 (comment) |
Hi @chriskrycho, may I suggest you take a look at the expect-type package? I am personally planning to move from |
That was super helpful, and we’re currently going exactly that way. It works extremely well. Thanks! |
@delvedor It doesn't expose the @phryneas Your project looks very nice. I have a good idea on how we could set this up to allow us to spawn multiple |
@SamVerschueren I've added version for 3.8.3 and 3.9.5. But I've adjusted the script a little and now it comes down to me just running ./makeVersion.sh 3.8.3
./makeVersion.sh 3.9.5 and then sight-checking & committing the generated files. I think that's pretty effective ^^ (and of course I accidentally just now committed it without the extra |
Thanks to the work of @phryneas I am already able to do something like this. In my type definition, I used the nullish coalescing operator which was introduced in TypeScript@3.7. The older versions report issues on that, which is pretty slick! It still need some more work though. Let's say it still in proof-of-concept phase :). |
I would love it if one could specify to use the TS version installed outside of Then one could run Would it maybe be possible to use |
@voxpelli the problem is that tsd requires a patched TS version... |
@SamVerschueren did you ever upload that proof of concept to a feature branch or anything? I'd like to flesh it out and update it with |
FI: I created a hybrid solution unleashed-typescript for my vitest plugin, not ideal but it avoids maintaining a custom version of TS and it allows to have a version of TS synchronized with your environment. I think it's possible to modify it a bit to make several patched versions of TS cohabit, a kind of package manager dedicated to TS. |
I recently thought about this, and not sure if this is something we want. But I can assume that some people want to know if the type definitions work for TypeScript >=3.1.0 for instance.
I think it would be possible if we dynamically installed TypeScript depending on
engines.typescript
or something inpackage.json
.One thing to figure out though is that we need two private methods from within TypeScript which aren't exposed. I worked around this by shipping TypeScript myself with two extra manually added lines. So if we want to do this, we need to find a way to dynamically add them. Don't think it's impossible, just makes it a bit harder.
Don't think it would be a good idea to ship this library with 10 TypeScript versions 😂.
The text was updated successfully, but these errors were encountered: