Skip to content

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

Merged
Orta Therox (orta) merged 2 commits into
v2from
use_tsc_for_checking_params
Jul 19, 2021
Merged

Orta Therox (orta) merged 2 commits into
v2from
use_tsc_for_checking_params

Conversation

@orta

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

and includes a fix for #1919

@orta
Orta Therox (orta) merged commit ae60129 into v2 Jul 19, 2021
@jakebailey
Jake Bailey (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

1 participant