tplant
tplant copied to clipboard
Add support for 'types'
As a Dev I need a support for 'types'
e.g.
type ExampleType = string | Function;
Can you provide a sample input typescript and the corresponding plantuml?
For simple purposes, a type can behave in UML just like an interface. For example,
type SetupType = {
active?: boolean
comment?: string | string[]
params?: any
}
can map to
@startuml
interface SetupType {
+active?: boolean | undefined
+comment?: string | string[] | undefined
+params?: any
}
@enduml
but instead of interface
it should be type
with (mabye) the resulting I
turned to T
. This would be useful to parse existing code that are already using type
and its syntax, instead of having to change them all to interface
.
For the OP's original request, I'm guessing this would suffice
@startuml
interface ExampleType {
}
@enduml
again, replacing the interface
syntax with the type
syntax.
+1, this would be great to have
For reference, the latest TypeScript documentation effectively says that Interfaces and Type aliases are interchangable: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces. Which one the user uses is largely down to personal preference.
Sending out type
as interface
should be straight forward enough.