Replace import = syntax to avoid Node 24 strip-only mode failure #770
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes the use of TypeScript import = (import equals) syntax, which is not supported when running in Node 24’s strip-only mode.
Under Node 24, when TypeScript files are executed without full transpilation (e.g., using the built-in strip-only TypeScript loader), import = statements are left untouched in the output and cause a runtime syntax error:
It is not valid JavaScript syntax and requires transpilation to work.
Node 24’s strip-only mode only removes type annotations but does not transpile TS-only constructs.
As a result, import LogLevel = rpc.RpcLog.Level; is emitted unchanged and fails at runtime.
Changes Made
Replaced import = usage with supported ECMAScript import syntax.
Used type-only imports where applicable to preserve type safety without introducing runtime overhead.
Updated related references to use the new syntax consistently.
Example change:
Benefits
Fully compatible with Node 24 strip-only mode.
No change in runtime behavior.
Aligns with modern TypeScript and ECMAScript module standards.
Reduces reliance on legacy TypeScript module patterns.
Testing
Verified unit tests pass in Node 20 and Node 24.
Confirmed no ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX is thrown during test execution.
Pipeline Run
https://azfunc.visualstudio.com/public/_build/results?buildId=232602&view=results