Skip to content

Conversation

@swapnil-nagar
Copy link
Contributor

@swapnil-nagar swapnil-nagar commented Aug 13, 2025

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:


SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]: 
TypeScript import equals declaration is not supported in strip-only mode
Root Cause
import = is a TypeScript-specific construct for compatibility with CommonJS modules.

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:

// Before
import LogLevel = rpc.RpcLog.Level;

// After
import type { RpcLog } from '...';
type LogLevel = RpcLog.Level;

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

@swapnil-nagar swapnil-nagar requested a review from a team as a code owner August 13, 2025 06:48
@swapnil-nagar swapnil-nagar merged commit f48616e into v3.x Aug 13, 2025
16 checks passed
@swapnil-nagar swapnil-nagar deleted the swapnil/fixingPipelineFailures branch August 13, 2025 17:56
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.

4 participants