Skip to content

Use the compiler options as a backup for finding compiler options from inside the param handling code #1940

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

Merged
merged 2 commits into from
Jul 19, 2021

Conversation

orta
Copy link
Contributor

@orta orta commented Jul 19, 2021

Prior versions of the playground have just relied on a big 'defaults dump' to use as a reference about what compiler options are recognized from the url query. This works well enough _if you are completely on top of all compiler options and updating the website, but I've been doing a lot of work outside of the website and it's a bad call to rely on that in the future.

export function getDefaultSandboxCompilerOptions(config: SandboxConfig, monaco: Monaco) {
const useJavaScript = config.filetype === "js"
const settings: CompilerOptions = {
noImplicitAny: true,
strictNullChecks: !useJavaScript,
strictFunctionTypes: true,
strictPropertyInitialization: true,
strictBindCallApply: true,

This PR re-uses the same idea as #1735 which is that we have the TS compiler in the runtime, so we should use that to validate whether a param a legit compiler flag even if it's not available in playground the defaults.

@orta
Copy link
Contributor Author

orta commented Jul 19, 2021

and includes a fix for #1919

@orta orta enabled auto-merge July 19, 2021 08:58
@orta orta merged commit ae60129 into v2 Jul 19, 2021
@jakebailey jakebailey deleted the use_tsc_for_checking_params branch May 17, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant