question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing .ts files in .tsx.

See original GitHub issue

When import .ts in .ts or .tsx in .tsx, it doesn’t add extension. That’s great. But when I am using both extension files .ts and .tsx it auto completes with .ts and etc.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DovydasNavickascommented, Oct 26, 2016

@galman33 is actually right, @MartynasZilinskas meant the exact situation that @galman33 explained. And the both extensions should be stripped, because they produce same output (.js file), only the processing is different according to extension, i.e. you can use JSX syntax in .tsx file.

So, conclusion is that we still need the functionality to strip both extensions.

0reactions
wsz7777commented, Dec 9, 2019

why can’t resloved ? have same name files use setting to Path Intellisense which looks like:

"path-intellisense.extensionsToStripOnImport": [
  ['tsx', 'ts'],
  ['jsx', 'js'],
] 

this have other problems ?

it finds two files with the same name use default first . [‘jsx’,‘js’] , index.js & index.jsx use index.jsx [‘js’,‘jsx’] , index.js & index.jsx use index.js

how about this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot import .tsx file from .ts file (and vice versa)
import WriteEditor from './write_editor.tsx';. Now my IDE tells me not to write the extensions tsx and I get an errors in src/write_editor.
Read more >
How to Import another TypeScript Files ? - GeeksforGeeks
In the TypeScript file which is to be imported must include an export form and the main file where the class is imported...
Read more >
An import path cannot end with a '.tsx' extension in TS
The error "An import path cannot end with a '.tsx' extension" occurs when we include the extension when importing TypeScript files in a...
Read more >
Documentation - Module Resolution - TypeScript
A relative import is resolved relative to the importing file and cannot resolve to an ambient module declaration. You should use relative imports...
Read more >
TypeScript - webpack
tsx files through the ts-loader , and output a bundle.js file in our current directory. Now lets change the import of lodash in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found