Generated interface files do not import dependencies
See original GitHub issueTL;DR
- If
[ExportTs*]
targets aclass
- imports are specified correctly - If
[ExportTs*]
targets aninterface
- imports are omitted
Problem
I have something like this
# ISomeInterface.cs
[ExportTsInterface]
public interface ISomeInterface {
IList<IOtherInterface> Others { get; set; }
}
# IOtherInterface.cs
[ExportTsInterface]
public interface IOtherInterface {
}
Generated files:
# i-some-interface.ts
# there's no "import { IOtherInterface } from './i-other-interface.ts';" here
export interface ISomeInterface {
others: IOtherInterface[];
}
Typescript compiler now gives me an error
ERROR in src/i-some-interface.ts(12,17): error TS2304: Cannot find name 'IOtherInterface'
If I use [ExportTsInterface]
on a class instead, *.ts
files now correctly have import { IOtherInterface } from ...
in them.
Environment
Nuget:
<PackageReference Include="TypeGen" Version="2.4.7" />
Tool:
"dotnet-typegen": {
"version": "2.4.7",
"commands": [
"dotnet-typegen"
]
}
tgconfig
:
{
"assemblies": [
"src/web/bin/Release/netcoreapp3.0/web.dll",
"src/web/bin/Release/netcoreapp3.0/core.dll",
"src/web/bin/Release/netcoreapp3.0/infrastructure.dll"
],
"clearOutputDirectory": true,
"outputPath": "src/front-end/src/models",
"createIndexFile": true,
"enumStringInitializersConverters": [],
"customTypeMappings": {
"NodaTime.Instant": "Date"
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Can't use interfaces from another file when they import any ...
typescript - Can't use interfaces from another file when they import any dependencies - Stack Overflow.
Read more >Update on implementation-only imports - Compiler
A generated module interface (.swiftinterface file) will not make any mention of SecretKit, and should not reference anything from SecretKit ...
Read more >Can´t get my interface file working
I have generated an interface file and have the project structure set up accodring to your guidance in Intellij. But it can´t find...
Read more >IntelliJ not able to resolve classes of external Libraries for ...
I imported a maven project and IntelliJ was able to load all the dependencies. Project is building fine. Issue is in all my...
Read more >3.7. Separate compilation
The interface file for A contains information needed by the compiler when it compiles any module B that imports A, whether directly or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
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
Hey, this is just an update that although I haven’t released the fix, I do keep this issue in mind and I’ll fix it whenever I have a moment for it.
Looks like it works fine. Thanks.