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

bug(common): xml2js import in comment/web/types is not building when called as a part of common/web/keyboard-processor #11716

Closed
mcdurdin opened this issue Jun 6, 2024 · 2 comments · Fixed by #11718
Assignees
Milestone

Comments

@mcdurdin
Copy link
Member

mcdurdin commented Jun 6, 2024

10:26:35   ../types/build/src/deps/xml2js/xml2js.d.ts(10,25): error TS7016: Could not find a declaration file for module './parser.js'. '/var/lib/TeamCity/work/30ffb35c1b6c4089/keyman/common/web/types/src/deps/xml2js/parser.js' implicitly has an 'any' type.
10:26:35   ../types/build/src/deps/xml2js/xml2js.d.ts(11,26): error TS7016: Could not find a declaration file for module './builder.js'. '/var/lib/TeamCity/work/30ffb35c1b6c4089/keyman/common/web/types/src/deps/xml2js/builder.js' implicitly has an 'any' type.
10:26:35   ../types/build/src/main.d.ts(34,25): error TS7016: Could not find a declaration file for module './deps/xml2js/xml2js.js'. '/var/lib/TeamCity/work/30ffb35c1b6c4089/keyman/common/web/types/src/deps/xml2js/xml2js.js' implicitly has an 'any' type.
10:26:35   ../types/build/src/main.d.ts(34,25): error TS7016: Could not find a declaration file for module './deps/xml2js/xml2js.js'. '/var/lib/TeamCity/work/30ffb35c1b6c4089/keyman/common/web/types/src/deps/xml2js/xml2js.js' implicitly has an 'any' type.

Regression arising from #11660. Causing builds to fail on master, which suggests a potential confict with #11424?

@mcdurdin mcdurdin added this to the A18S3 milestone Jun 6, 2024
@mcdurdin mcdurdin self-assigned this Jun 6, 2024
@mcdurdin
Copy link
Member Author

mcdurdin commented Jun 6, 2024

This is happening due to inconsistency in the tsconfig.json compilerOptions between web and common/web/types. Specifically, in this instance, allowJs diverges from the global default:

"allowJs": false,

The problem seems to be that tsc --build in common/web/keyboard-processor will attempt to build common/web/types using the settings from common/web/keyboard-processor/tsconfig.json.

How best to resolve this? I can see various strategies we could use:

  1. Eliminate all compilerOptions overrides across all tsconfig.json files. This is a good long-term solution, as it simplifies our build environment, but it may be difficult to pull off.
  2. Side-step the dependency problem by moving the remaining modules which depend on xml2js to the developer source tree (refactor(common): move source types out of common/web/types into developer-utils #9665): kpj-file, kvks-file, ldml-keyboard-xml, kps-file. We will be doing this anyway, and have started in refactor(common): move kpj-related files into developer-utils 🐉 #11531 with kpj-file, but this work was not on the plan for this sprint.
  3. Patch this specific issue. I am not sure of the most reliable approach to doing this at present; I patched out the allowJs property from web/tsconfig.base.json and the build then succeeded, but it may cause other problems?

@jahorton
Copy link
Contributor

jahorton commented Jun 6, 2024

If memory serves, the allowJs was originally in place due to its interaction with emitting .d.ts files; there was a point where TS would refuse to emit declaration files if allowJS were true. We're past that point now, and it appears that no build errors resulted - that would be the only potential complication I'd worry about here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants