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

BYO tsconfig - typesVersions not respecting outDir in tsconfig file #1234

Closed
jci-aws opened this issue Aug 9, 2024 · 0 comments · Fixed by #1238
Closed

BYO tsconfig - typesVersions not respecting outDir in tsconfig file #1234

jci-aws opened this issue Aug 9, 2024 · 0 comments · Fixed by #1238

Comments

@jci-aws
Copy link

jci-aws commented Aug 9, 2024

I am using the new tsconfig option. In my tsconfig.json, I have outDir set to lib. I have not changed my tsconfig.json file at all from the JSII-generated tsconfig.json.

If I set outDir in my tsconfig.json to some value other than ".", the typesVersions key in package.json references the wrong path:

  "typesVersions": {
    "<=3.9": {
-     "lib/*": [
-       "lib/.types-compat/ts3.9/*",
-       "lib/.types-compat/ts3.9/*/index.d.ts"
+     "*": [
+       ".types-compat/ts3.9/*",
+       ".types-compat/ts3.9/*/index.d.ts"
      ]
    }
  },

I can get around this by setting my jsii config section to this:

  "jsii": {
    "tsc": {
      "outDir": "lib"
    },
    "tsconfig": "tsconfig.json",
    "validateTsconfig": "generated"
  },

but I think ideally JSII should use the outDir from the BYO tsconfig if possible.

github-merge-queue bot pushed a commit that referenced this issue Aug 13, 2024
Fixes #1234 

Also fixes an issue related the `.type-compat` output path that was
discovered when adding tests. When getting `outdir` from the program,
this might be either a relative or absolute path. Previously the code
assumed it was always relative which is not correct. This led to
absolute paths being used for the `.type-compat` dir and in the post
processing; ultimately leading to a compilation failure. The fix is to
ensure `outdir` & `.type-compat` are normalized to a relative path.

---

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
aws-cdk-automation pushed a commit that referenced this issue Aug 13, 2024
Fixes #1234

Also fixes an issue related the `.type-compat` output path that was
discovered when adding tests. When getting `outdir` from the program,
this might be either a relative or absolute path. Previously the code
assumed it was always relative which is not correct. This led to
absolute paths being used for the `.type-compat` dir and in the post
processing; ultimately leading to a compilation failure. The fix is to
ensure `outdir` & `.type-compat` are normalized to a relative path.

---

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 072239b)
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 a pull request may close this issue.

1 participant