You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When importing a .ts file strictly for side effects,
import'./a.ts';
I expect that this will be accepted by the typechecker. In fact, even if a.ts didn't exist, this would still be valid TS, see #50394 (comment) for a motivating example.
Typechecking with --noEmit validates this without error.
Typechecking with --watch gives me error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
a.ts
console.log("I'm a side effect!");
b.ts
import'./a.ts';
tsconfig.json
{}
π Actual behavior
% npx tsc --noEmit # no output. Valid!
% npx tsc --watch
[5:54:03 PM] Starting compilation in watch mode...
b.ts:1:8 - error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
1 import './a.ts';~~~~~~~~
[5:54:04 PM] Found 1 error. Watching for file changes.
I shouldn't see a new error only in --watch mode.
π Expected behavior
% npx tsc --noEmit # no output. Valid.
% npx tsc --watch
[5:54:37 PM] File change detected. Starting incremental compilation...
[5:54:37 PM] Found 0 errors. Watching for file changes.