-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Configuring which TypeScript version is used? #942
Comments
It would be great if changing the |
Is this deployed yet? I can't seem to get CodeSandbox to use any TypeScript version other then |
@aleclarson so what does this change? |
I guess the issue is that the new syntax cannot be used on the online editor, so this change did not really fix the issue, just prepared for the fix if I understand correctly. |
Shouldn't this be re-opened again then? |
Could this be re-opened? 🙏 |
What's the current status? I see that changing |
It only changes the TypeScript version used by the bundler right now. It's not in the editor yet, as it would require us to dynamically update the VSCode Extensions. I can tackle that one this weekend, it slipped my todo. |
@CompuIves voicing my support for this as well and checking to see if you have any updates on this issue? Cheers |
Bump: same =). I have a library that depends on TS 4.0+ and would like to demo it but it's pretty awkward having lots of type errors there. |
I think this one can be closed since #4583 is merged. |
This issue has automatically been marked stale because there has been no activity in a while. Please leave a comment if the issue has not been resolved, or if it is not stale for any other reason. After 2 weeks, this issue will automatically be closed, unless a comment is made or the stale label is removed. |
@MichaelDeBoey if I interpret this right, adding
to the Because right now, it seemingly doesn't 😞 (Quick CSB for checking: link) |
Oh that's right, we don't dynamically set it based on dependencies, but rather based on a string in our code. That's what the mentioned PR fixed. I took a look at the time to see if we could initialize it based on the sandbox config, but I wasn't able to make it work yet as the extension host starts before we fetch the sandbox. That's the most challenging part, it surely is possible, but we need to restart the extension host whenever the TypeScript version changes (eg. you add it as dependency) or when you change sandbox. Because of this we make the extension host dependent on the sandbox, which will slow the editor initialization for a bit (first we need to fetch the sandbox before we can load the editor). It's something that I think should happen, but it's not implemented yet. |
Thank you for your clarify. The stackblitz also has this problem. We just confusing and thought it could be "dynamic" updated cause this issue closed and a fixed pr linked to this... |
@CompuIves in the long run, it would be great if we had this option of switching, especially for new TS betas etc. |
Duplicate of #5598 |
@phryneas Apologies if I'm misunderstanding - it should be possible to add a new Typescript version through the dependencies on a sandbox by sandbox basis |
@JamesACS if you're saying that's a feature in place today or there's workarounds for this, it's not true from my experience. The problem is that the codesandbox doesn't let you choose which TS to have the IDE evaluation code against (even if you manually add the ts version), which leads to those false positives. |
Ah @barrymay I'm with you now - I'll raise this as a feature request |
Thanks! By the way I think that #5598 and this are in the same vein. If a new Sandbox used the currently latest stable TS and (if possible) let users switch the version for ide evaluation (in the same vein that VSCode does natively) it would solve both issues. It only started out at 4.2 because that's how long this has been going on. |
I've added it as a sub-feature request on our end. The main topic being upgrading the TS version, then as a side making the version selectable in the client if possible :) |
I use Codesandbox primarily to reproduce issues to share on Github. It happens often enough that I run into a type error with a particular version of Typescript, but not in another. This is my usecase for needing to be able to select an arbitrary Typescript version. Just wanted to add this in case it helps. |
Hi there, it's a shame that stackblitz/core#337 had to be locked due to poor behavior from a user. But the last status update on that thread was:
I'm just wondering if there's
It's a bit confusing to see typescript errors in a project that specifies a version of typescript that supports the syntax I'm using, so I think it would help avoid a lot of confusion if it was clear what version of TS is being used, at least. |
Update: This issue has been resolved in stackblitz/core/issues/337. TL;DR You can also pick the workspace version, allowing you to configure your typescript versions on a per repo basis if desired. Addition context in the issue if anyone's interested! |
I think I lost track of this issue, but the new editor of CodeSandbox also supports this. It will use the version of Typescript that you have installed in your workspace. The new editor is enabled by default for Cloud Sandboxes, and we're slowly enabling this as well for browser sandboxes. |
I'll close this issue as soon as we've made the full move, but for now if you want to use it already, we have an option in the editor to convert your sandbox to a cloud sandbox. This would also allow you to get our AI & VSCode integration for that sandbox. |
@CompuIves how do I enable it now? |
It should be enabled by default by now! We're also going to release Web VS Code mode soon for all users which allows you to install extensions. If you want to use it already you can do enable it from your experiments (is in the user settings in the editor). |
Unfortunately even with VS Code Web enabled it doesn't seem to have a version selector. I can go to https://codesandbox.io/p/sandbox/muddy-hill-sjfzwl, focus a TSX file, and whether I have VS Code Web enabled or not, this is all that displays: and clicking it brings this up: no way to select the version. If you check my |
Interesting, we should use the TypeScript version that's defined in |
@CompuIves How do I verify which version is being used? If you're just cloning the specified version it won't work with compiler plugins, which are what I'm trying to do here (it offers autocomplete for CSS Module imports). |
You can use this: import { TSVersion } from "@phryneas/ts-version";
type Version = `${TSVersion.Major}.${TSVersion.Minor}`; and then hover |
Also, devDependencies are not being installed at all. If I place See: https://codesandbox.io/p/sandbox/prod-glitter-qqr586 Keep in mind this is web and not a cloud container/devbox/whatever. I need this to work in web. |
Can we make it so that I can configure which version of TypeScript to use? Can I (for instance) install
typescript@next
and use that?The text was updated successfully, but these errors were encountered: