Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 'types' #47

Open
RamzesTheSecond opened this issue Feb 5, 2020 · 5 comments
Open

Add support for 'types' #47

RamzesTheSecond opened this issue Feb 5, 2020 · 5 comments

Comments

@RamzesTheSecond
Copy link

As a Dev I need a support for 'types'

e.g.

type ExampleType = string | Function;

@RamzesTheSecond RamzesTheSecond changed the title Add support for types Add support for 'types' Feb 5, 2020
@bafolts
Copy link
Owner

bafolts commented Feb 6, 2020

Can you provide a sample input typescript and the corresponding plantuml?

@hkong
Copy link

hkong commented Oct 8, 2021

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.

@pierscowburn
Copy link

+1, this would be great to have

@pierscowburn
Copy link

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.

@bafolts
Copy link
Owner

bafolts commented Nov 29, 2021

Sending out type as interface should be straight forward enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants