Reinforced.Typings
Reinforced.Typings copied to clipboard
TypeScript type in another assembly
Only when I'm using a class from another assembly I get the following waring:
Type resolvation warning RT0003: Could not find suitable TypeScript type for xxx. 'any' assumed.
I know I can use 'RtAdditionalAssembly' to fix it, but thats not what I want. This option generates TypeScript for all classes of the included assembly (as expected, but I only want to let the builder know where to get the class from).
Could not find suitable TypeScript type for xxx. is being thrown when xxx was not exported (it is found, but you have not point RT to export it with attributes or fluent configuration). So RT simply reports it as warning in order to make it easier to find out why particular field/method/parameter has any type. Do not treat RT's warnings as errors.
In order to get rid of this warning - you can explicitly use [TsProperty(Type = "any")] on the field that induces this error. Or use substitutions, or type inferers or just ignore it.
I know it's possible to use the 'TsProperty' attribute, but I would expect diffrent behaviour.
Below some sample code to demonstrate my problem:
// Project A
// Reference to project B
[TsInterface]
class Foo : IBaz {
Bar Bar {get; set;}
}
// Project B
[TsInterface]
class Bar {
}
[TsInterface]
interface IBaz {
}
will result in:
export interface IFoo extends B.IBaz {
Bar: any;
}
but shoud result in:
export interface IFoo extends B.IBaz {
Bar: B.Bar;
}
Why can Foo be extanded from Baz, but cant the property Bar be the correct type?
That is strange. I will check in tests
I am having this issue as well. @thombrink did you ever find a fix?
I stopped using this nuget and switched to nswag.
Was going to switch as well but found out you can fix this issue by adding the following to your Reinforced.Typings.settings.xml:
<ItemGroup>
<RtAdditionalAssembly Include="$(SolutionDir)\<otherproject>\bin\Debug\net6.0\<othernamespace.otherclass>.dll"/>
</ItemGroup>