Open backfromexile opened 9 months ago
After thinking about this and experimenting a bit, I think it's best we support two scenarios:
export type MyType =
). These should be used to transpile the type definitions inside the default ITypeTranslator
. Imo, these should work for all types, not just the ones marked with [TranspilationSource]
to support custom type converters for external types.However, I think 2 isn't really necessary if we support generic type translation and support custom type converters.
Tapper does not consider custom type mappers for types. This makes it impossible to map types that cannot be marked as
[TranspilationSource]
, for example types that have been defined in an external package (also related to https://github.com/nenoNaninu/Tapper/issues/133).Tapper should fetch custom
ITypeTranslator
s from the transpiled project file.For this, we probably need another attribute to mark type mappers as mappers for specific types.
Proposal:
[TypeTranslator(params Type[] sourceTypes)]
This should work with normal types, and generic types (e.g.
Optional<T>
) as well as concrete generic types (e.g.Optional<string>
).https://github.com/nenoNaninu/Tapper/pull/164 already adds the foundation for generic type transliation, but support for concrete generic type translation is still missing here.
After this has been implemented, it should be fairly easy to define the
TypeTranslator
attribute.