Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

ReactRedux configuration doesn't play well with TypeScript tools #1205

Closed
rosieks opened this issue Aug 18, 2017 · 3 comments
Closed

ReactRedux configuration doesn't play well with TypeScript tools #1205

rosieks opened this issue Aug 18, 2017 · 3 comments

Comments

@rosieks
Copy link
Contributor

rosieks commented Aug 18, 2017

Current configuration of ReactRedux project doesn't work well with TypeScript code actions. In my case I have two files:

  • /ClientApp/logs/components/LogsList.tsx
  • /ClientApp/logs/components/OperationLogs.tsx

When I try to add import to LogsList.tsx from OperationLogs.tsx the following line is added:

import { LogsList } from 'ClientApp/logs/components/LogsList';

Visual Studio doesn't show any errors but then when I run application I get such error:

NodeInvocationException: Prerendering failed because of error: Error: Cannot find module "ClientApp/logs/components/LogsList"

I have already reported to TypeScript repository that in such case they could use relative path microsoft/TypeScript#15888 (comment), but it would be nice to have that correctly configured in template.

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Aug 21, 2017

I think the syntax you need to use is something like:

import { LogsList } from './ClientApp/logs/components/LogsList';

i.e., with a leading ./. Of course, the exact relative path depends on where you're importing it into.

However, I'm guessing that you already know this, and the problem you're reporting is that the TypeScript tooling code action is generating the incorrect import. If so, that would be an issue for the TypeScript tooling folks to address. I'll close this since it's not something we can fix in this repo, but please let me know if you think we are doing something wrong in this repo!

@rosieks
Copy link
Contributor Author

rosieks commented Aug 21, 2017

I don't think that adding ./ will help - then it will be incorrect path and I believe that TypeScript tools works according to tsconfig.json so probably there is the issue.

@SteveSandersonMS
Copy link
Member

The actual correct relative path will depend on where the file is and where it's being referenced from, of course.

I believe that TypeScript tools works according to tsconfig.json so probably there is the issue.

I'm not clear on whether you're saying there's a fault in this repo or not. If you think something is wrong here, can you give an example of what change to the tsconfig.json you think we should make, and a scenario where it makes a difference?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants