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: lib setting from custom config is ignored #1576

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Dec 13, 2024

When a user provides a custom tsconfig.json file, they have the ability to override the lib setting, which provides a number of libraries that should be loaded at compile time.

This config setting is not passed directly into the TypeScript compiler. Instead, it is resolved and translated into a list of .d.ts file that are passed as rootNames to the compiler, along with the actual source files.

In that resolution, we failed to look at the lib setting the user provided, and instead always used the default config.

Fix by looking at the user-provided config, falling back to the default config only if the user config doesn't have a lib setting (mirroring the behavior of tsc).

Fixes aws/jsii#4706.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

When a user provides a custom `tsconfig.json` file, they have the ability
to override the `lib` setting, which provides a number of libraries
that should be loaded at compile time.

This config setting is not passed directly into the TypeScript compiler.
Instead, it is resolved and translated into a list of `.d.ts` file that
are passed as `rootNames` to the compiler, along with the actual source
files.

In that resolution, we failed to look at the `lib` setting the user
provided, and instead always reverted to the default config.

Fix by looking at the user-provided config, falling back to the default
config only if the user config doesn't have a `lib` setting (mirroring
the behavior of tsc).

Fixes #4706.
@rix0rrr rix0rrr requested a review from a team December 13, 2024 10:40
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Dec 13, 2024
Merged via the queue into main with commit 26a3d96 Dec 13, 2024
81 checks passed
@aws-cdk-automation aws-cdk-automation deleted the huijbers/lib-setting branch December 13, 2024 11:08
aws-cdk-automation pushed a commit that referenced this pull request Dec 13, 2024
When a user provides a custom `tsconfig.json` file, they have the
ability to override the `lib` setting, which provides a number of
libraries that should be loaded at compile time.

This config setting is not passed directly into the TypeScript compiler.
Instead, it is resolved and translated into a list of `.d.ts` file that
are passed as `rootNames` to the compiler, along with the actual source
files.

In that resolution, we failed to look at the `lib` setting the user
provided, and instead always used the default config.

Fix by looking at the user-provided config, falling back to the default
config only if the user config doesn't have a `lib` setting (mirroring
the behavior of tsc).

Fixes aws/jsii#4706.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit 26a3d96)
aws-cdk-automation pushed a commit that referenced this pull request Dec 13, 2024
When a user provides a custom `tsconfig.json` file, they have the
ability to override the `lib` setting, which provides a number of
libraries that should be loaded at compile time.

This config setting is not passed directly into the TypeScript compiler.
Instead, it is resolved and translated into a list of `.d.ts` file that
are passed as `rootNames` to the compiler, along with the actual source
files.

In that resolution, we failed to look at the `lib` setting the user
provided, and instead always used the default config.

Fix by looking at the user-provided config, falling back to the default
config only if the user config doesn't have a `lib` setting (mirroring
the behavior of tsc).

Fixes aws/jsii#4706.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit 26a3d96)
aws-cdk-automation pushed a commit that referenced this pull request Dec 13, 2024
When a user provides a custom `tsconfig.json` file, they have the
ability to override the `lib` setting, which provides a number of
libraries that should be loaded at compile time.

This config setting is not passed directly into the TypeScript compiler.
Instead, it is resolved and translated into a list of `.d.ts` file that
are passed as `rootNames` to the compiler, along with the actual source
files.

In that resolution, we failed to look at the `lib` setting the user
provided, and instead always used the default config.

Fix by looking at the user-provided config, falling back to the default
config only if the user config doesn't have a `lib` setting (mirroring
the behavior of tsc).

Fixes aws/jsii#4706.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

(cherry picked from commit 26a3d96)
@aws-cdk-automation
Copy link
Collaborator

💚 All backports created successfully

Status Branch Result
maintenance/v5.4
maintenance/v5.5
maintenance/v5.6

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

github-merge-queue bot pushed a commit that referenced this pull request Dec 13, 2024
)

# Backport

This will backport the following commits from `main` to
`maintenance/v5.6`:
- [fix: `lib` setting from custom config is ignored
(#1576)](#1576)

<!--- Backport version: 9.5.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

Co-authored-by: Rico Hermans <rix0rrr@gmail.com>
github-merge-queue bot pushed a commit that referenced this pull request Dec 13, 2024
)

# Backport

This will backport the following commits from `main` to
`maintenance/v5.4`:
- [fix: &#x60;lib&#x60; setting from custom config is ignored
(#1576)](#1576)

<!--- Backport version: 9.5.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

Co-authored-by: Rico Hermans <rix0rrr@gmail.com>
github-merge-queue bot pushed a commit that referenced this pull request Dec 13, 2024
)

# Backport

This will backport the following commits from `main` to
`maintenance/v5.5`:
- [fix: &#x60;lib&#x60; setting from custom config is ignored
(#1576)](#1576)

<!--- Backport version: 9.5.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

Co-authored-by: Rico Hermans <rix0rrr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSII does not respect lib/target specified in custom tsconfig
3 participants