Skip to content

Conversation

@JoshuaKGoldberg
Copy link
Contributor

Per my interpretation of a brief discussion on alwaysStrict in Discord, changes the default value for that setting to off.

Note that this doesn't imply anything about TypeScript's recommendations around strict mode. It just changes the playground to not emit a "use strict"; on top of emitted JS. That string has been a thorn in my side trying to teach TypeScript in workshops for years.

@jakebailey
Copy link
Member

I am still not entirely convinced that this is a good idea, but, in what conditions do we currently actually emit it? The default settings on the playground don't show "use strict"; in the JS output.

@JoshuaKGoldberg
Copy link
Contributor Author

If the current file is a script (rather than a module). https://www.typescriptlang.org/play?#code/Q:

Screenshot of the TypeScript playground with no input code. The output is "use strict";

@jakebailey
Copy link
Member

Ah, I had some stuff sitting in my browser.

@jakebailey jakebailey added the deploy-preview Enables automatic deployments to preview environments on a PR label Feb 1, 2024
@jakebailey
Copy link
Member

Per microsoft/TypeScript#62213, we're going in the opposite direction on this such that all code will be forcibly strict (and get this prologue if not ESM).

I think better would be to modernize the playground's options to not target CJS.

@jakebailey jakebailey closed this Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy-preview Enables automatic deployments to preview environments on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants