Skip to content

Commit

Permalink
Cleanup "ts=Nightly", aka "ts=next" (#3156)
Browse files Browse the repository at this point in the history
  • Loading branch information
rotu authored Jun 12, 2024
1 parent 7cdd061 commit 7cf9aa0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ if (!obj.prop) {
}
```

[Try running the following example](https://www.typescriptlang.org/play?ts=Nightly#code/MYewdgzgLgBCBGArGBeGBvAsAKBnmA5gKawAOATiKQBQCUGO+TMokIANkQHTsgHUAiYlChFyMABYBDCDHIBXMANoBuHI2Z4A9FpgAlIqXZTgRGAFsiAQg2byJeeTAwAslKgSu5KWAAmIczoYAB4YAAYuAFY1XHwAXwAaWxgIEhgKKmoAfQA3KXYALhh4EA4iH3osWM1WCDKePkFUkTFJGTlFZRimOJw4mJwAM0VgKABLcBhB0qCqplr63n4BcjGCCVgIMd8zIjz2eXciXy7k+yhHZygFIhje7BwFzgblgBUJMdlwM3yAdykAJ6yBSQGAeMzNUTkU7YBCILgZUioOBIBGUJEAHwxUxmqnU2Ce3CWgnenzgYDMACo6pZxpYIJSOqDwSkSFCYXC0VQYFi0NMQHQVEA) to see how that differs from _always_ performing the assignment.
[Try running the following example](https://www.typescriptlang.org/play?ts=next#code/MYewdgzgLgBCBGArGBeGBvAsAKBnmA5gKawAOATiKQBQCUGO+TMokIANkQHTsgHUAiYlChFyMABYBDCDHIBXMANoBuHI2Z4A9FpgAlIqXZTgRGAFsiAQg2byJeeTAwAslKgSu5KWAAmIczoYAB4YAAYuAFY1XHwAXwAaWxgIEhgKKmoAfQA3KXYALhh4EA4iH3osWM1WCDKePkFUkTFJGTlFZRimOJw4mJwAM0VgKABLcBhB0qCqplr63n4BcjGCCVgIMd8zIjz2eXciXy7k+yhHZygFIhje7BwFzgblgBUJMdlwM3yAdykAJ6yBSQGAeMzNUTkU7YBCILgZUioOBIBGUJEAHwxUxmqnU2Ce3CWgnenzgYDMACo6pZxpYIJSOqDwSkSFCYXC0VQYFi0NMQHQVEA) to see how that differs from _always_ performing the assignment.

```ts twoslash
const obj = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ The dropdown shows the highest patch version for a TypeScript release, but that

Setting a TypeScript version will append `?ts=[version]` to your URL and reload. For example, setting the TypeScript version to 4.3.5 will add `?ts=4.3.5` to the URL, which is an OK segue to the overview of the [URL's structure](/play#handbook-10).

There's one special case where `?ts=Nightly` will find the latest version of the TypeScript which was built for the Playground and use that.
There's one special case where `?ts=next` will find the latest version of the TypeScript which was built for the Playground and use that.
5 changes: 2 additions & 3 deletions packages/playground-handbook/copy/en/URL Structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ Then the query string tend to be about changing the state of the Playground setu

There are two special cases for the `ts` option:

- `ts=Nightly` where it will switch to most recently the nightly version.

- `ts=dev` where it uses your [local developer's build of TypeScript](https://github.com/microsoft/TypeScript/blob/main/scripts/createPlaygroundBuild.js)
- `ts=next`: Use the most recent [nightly build](https://www.typescriptlang.org/docs/handbook/nightly-builds.html).
- `ts=dev`: Use your [local developer's build of TypeScript](https://github.com/microsoft/TypeScript/blob/main/scripts/createPlaygroundBuild.js)

- `?flag=value` - Any compiler flag referenced in can be set from a query
- `?filetype=js|ts|dts` - Tells the Playground to set the editor's language
4 changes: 2 additions & 2 deletions packages/playground/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Then queries tend to be about changing the state of the Playground setup from th

There are two special cases for the `ts` option:

- `ts=Nightly` where it will switch to most recently the nightly version.
- `ts=dev` where it uses your [local developer's build of TypeScript](https://github.com/microsoft/TypeScript/blob/main/scripts/createPlaygroundBuild.js)
- `ts=next`: Use the most recent [nightly build](https://www.typescriptlang.org/docs/handbook/nightly-builds.html).
- `ts=dev`: Use your [local developer's build of TypeScript](https://github.com/microsoft/TypeScript/blob/main/scripts/createPlaygroundBuild.js)

- `?flag=value` - Any compiler flag referenced in can be set from a query
- `?filetype=js|ts|dts` - Tells the Playground to set the editor's type
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Play: React.FC<Props> = (props) => {

let tsVersionParam = params.get("ts")
// handle the nightly lookup
if (!tsVersionParam || tsVersionParam && tsVersionParam === "Nightly" || tsVersionParam === "next") {
if (!tsVersionParam || tsVersionParam === "Nightly" || tsVersionParam === "next") {
// The CDN is configured to have a short TTL on the indexes directory.
const nightlyLookup = await fetch("https://playgroundcdn.typescriptlang.org/indexes/next.json", { cache: "no-cache" })
const nightlyJSON = await nightlyLookup.json()
Expand Down
2 changes: 1 addition & 1 deletion packages/typescriptlang-org/src/templates/play.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const Play: React.FC<Props> = (props) => {

let tsVersionParam = params.get("ts")
// handle the nightly lookup
if (tsVersionParam && tsVersionParam === "Nightly" || tsVersionParam === "next") {
if (tsVersionParam === "Nightly" || tsVersionParam === "next") {
// The CDN is configured to have a short TTL on the indexes directory.
const nightlyLookup = await fetch("https://playgroundcdn.typescriptlang.org/indexes/next.json", { cache: "no-cache" })
const nightlyJSON = await nightlyLookup.json()
Expand Down

0 comments on commit 7cf9aa0

Please sign in to comment.