If you export a type and it depends on other types that are not exported, it would be really handy if dry-typescript could warn the user about this, or even automatically follow the dependency. For example
module Types
include Dry.Types()
end
module A
User = Types::Hash.schema(id: Types::String, name: Types::String)
end
module B
extend Dry::Typescript
ts_export Users = Types::Array.of(A::User)
end
In this example, dry-typescript would export:
export type Users = Array<{ id: string, name: string }>
Ideally, it should either flag that Users references a type from another unexported module, or it should follow the dependency automatically, and output:
export type User = {
id: string;
name: string;
}
export type Users = Array<User>;
The current solution for this would be to use ts_export_all to export A:
module B
extend Dry::Typescript
ts_export_all A
ts_export Users = Types::Array.of(A::User)
However, it would be a much better user experience if we could at least warn the user about this situation, so we can suggest to them that they export the dependencies.
If you export a type and it depends on other types that are not exported, it would be really handy if dry-typescript could warn the user about this, or even automatically follow the dependency. For example
In this example, dry-typescript would export:
Ideally, it should either flag that
Usersreferences a type from another unexported module, or it should follow the dependency automatically, and output:The current solution for this would be to use
ts_export_allto exportA:However, it would be a much better user experience if we could at least warn the user about this situation, so we can suggest to them that they export the dependencies.