Skip to content
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

fix transform tsconfigRaw type #2568

Merged
merged 2 commits into from Sep 23, 2022

Conversation

sapphi-red
Copy link
Contributor

This PR updates TransformOptions["tsconfigRaw"]["compilerOptions"] type based on:

esbuild/pkg/api/api_impl.go

Lines 1372 to 1405 in 23709e2

// Settings from "tsconfig.json" override those
var tsTarget *config.TSTarget
var tsAlwaysStrict *config.TSAlwaysStrict
caches := cache.MakeCacheSet()
if transformOpts.TsconfigRaw != "" {
source := logger.Source{
KeyPath: logger.Path{Text: "tsconfig.json"},
PrettyPath: "tsconfig.json",
Contents: transformOpts.TsconfigRaw,
}
if result := resolver.ParseTSConfigJSON(log, source, &caches.JSONCache, nil); result != nil {
if result.JSX != config.TSJSXNone {
jsx.SetOptionsFromTSJSX(result.JSX)
}
if len(result.JSXFactory) > 0 {
jsx.Factory = config.DefineExpr{Parts: result.JSXFactory}
}
if len(result.JSXFragmentFactory) > 0 {
jsx.Fragment = config.DefineExpr{Parts: result.JSXFragmentFactory}
}
if len(result.JSXImportSource) > 0 {
jsx.ImportSource = result.JSXImportSource
}
if result.UseDefineForClassFields != config.Unspecified {
useDefineForClassFieldsTS = result.UseDefineForClassFields
}
unusedImportFlagsTS = config.UnusedImportFlagsFromTsconfigValues(
result.PreserveImportsNotUsedAsValues,
result.PreserveValueImports,
)
tsTarget = result.TSTarget
tsAlwaysStrict = result.TSAlwaysStrictOrStrict()
}
}

@evanw evanw merged commit 1bce251 into evanw:master Sep 23, 2022
@sapphi-red sapphi-red deleted the fix-tranform-tsconfig-raw-types branch September 23, 2022 15:35
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.

None yet

2 participants