Import from index.ts export not working
See original GitHub issueIssue :
Import from index.ts export not working, ex: file structure: app |–shared |–index.ts |–utils.ts
utils.ts:
export function myFunction(){...
index.ts:
export * from 'utils.ts';
import {myFunction} from ‘app/shared’ doesn’t work in jest (works when running the app). export {myFunction} from ‘app/shared.index’ works.
Expected behavior :
ts-jest should work the same was as plain ts
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:11
Top Results From Across the Web
Imports in index.ts file are not getting correctly resolved. #29171
When running the project normally, the calling order is reversed as all external files import via index.ts so everything works as expected. It ......
Read more >Export all files in `index.ts` - Stack Overflow
In this case, you need to create an index.ts file in your components directory. First, import all of your components in it: import...
Read more >Consolidate Your TypeScript Imports With index.ts Files
When importing modules, TypeScript initially looks for an index.ts file. If one cannot be found, it will look for a file with the...
Read more >Using index.ts file to organize import statements.
Typescript module resolution picks up index.ts file from folder name if it is there and try to import packages. In this file, we...
Read more >Documentation - Modules .d.ts - TypeScript
The types which are exported can then be re-used by consumers of the modules using either import or import type in TypeScript code...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks a lot for the reproduce repo. I will take a look when there are some free times 👍
Oh it’s nice to hear that.
FYI the error comes from jest runtime, not typescript itself and ts-jest internal typescript compiler delivered the compiled js and jest runtime takes care of the rest.
Since it’s related to how jest runtime accepts the transpiled codes, ts-jest can’t do anything.