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
Don't elide imports when transforming JS files (#50404)
* don't elide imports in JS files
* WIP: get rid of caching of resolved symbol, add transform tests
* get rid of caching only for resolver functions
* use getReferencedSymbol instead of getReferencedValueSymbol in module transform
* WIP: add reportErrors flag to resolveName
* Import transformations now work correctly
* don't emit diagnostics when looking up referenced symbol
* small fixes and get rid of unnecessary comments
* update tests
* clean up
* CR: use nameNotFoundMessage to decide whether to report errors in resolveName
tests/cases/compiler/caller.js(1,21): error TS2307: Cannot find module 'fs' or its corresponding type declarations.
2
+
tests/cases/compiler/caller.js(2,8): error TS18042: 'TruffleContract' is a type and cannot be imported in JavaScript files. Use 'import("@truffle/contract").TruffleContract' in a JSDoc type annotation.
3
+
tests/cases/compiler/caller.js(4,43): error TS2708: Cannot use namespace 'TruffleContract' as a value.
4
+
tests/cases/compiler/caller.js(4,60): error TS2708: Cannot use namespace 'TruffleContract' as a value.
!!! error TS2307: Cannot find module 'fs' or its corresponding type declarations.
11
+
import TruffleContract from '@truffle/contract'; // Runtime err: this import is elided in transform
12
+
~~~~~~~~~~~~~~~
13
+
!!! error TS18042: 'TruffleContract' is a type and cannot be imported in JavaScript files. Use 'import("@truffle/contract").TruffleContract' in a JSDoc type annotation.
14
+
console.log(fs);
15
+
console.log('TruffleContract is ', typeof TruffleContract, TruffleContract); // `TruffleContract` is considered 'unused'
16
+
~~~~~~~~~~~~~~~
17
+
!!! error TS2708: Cannot use namespace 'TruffleContract' as a value.
18
+
~~~~~~~~~~~~~~~
19
+
!!! error TS2708: Cannot use namespace 'TruffleContract' as a value.
0 commit comments