Codesandbox-client: Configuring which TypeScript version is used?

Created on 3 Jul 2018  路  18Comments  路  Source: codesandbox/codesandbox-client

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?

Most helpful comment

Shouldn't this be re-opened again then?

All 18 comments

It would be great if changing the "typescript" version in package.json worked as expected. 馃槑

Is this deployed yet? I can't seem to get CodeSandbox to use any TypeScript version other then 3.3.3

@bengry From #1843:

This doesn't change which version is used by the editor yet, I'm meaning to change this later by introducing a BrowserFS backend that can handle UNPKG.

@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? :pray:

What's the current status? I see that changing typescript in devDependencies doesn't work?

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

@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 https://github.com/codesandbox/codesandbox-client/pull/4583 is merged.
Can anybody check this out?
I鈥檓 currently not on my laptop

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

{
  "dependencies": {
    "typescript": "4.1.2"
  },
}

to the package.json should make the editor use TS 4.1, correct?

Because right now, it seemingly doesn't :disappointed:

(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.

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.
In the meantime: could you please bump the CS TS version up to TypeScript 4.1? That would be a very big short-time win :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BingoRUS picture BingoRUS  路  3Comments

Haroenv picture Haroenv  路  3Comments

wojciechczerniak picture wojciechczerniak  路  3Comments

alansouzati picture alansouzati  路  3Comments

oliversturm picture oliversturm  路  3Comments