Skip to content

fix(core): format of optional type and getter/setter #804

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

Merged
merged 1 commit into from
Apr 15, 2025

Conversation

normanzb
Copy link
Contributor

@normanzb normanzb commented Apr 14, 2025

  • A naive fix for formatting issue when optional or getter/setter properties used
  • All example below was generated with useCodeBlock on

Type with an optional

current the plugin formats optional type in type declaration like so:

code:

export type TypeHasOptional = {
  foo?: string;
};

before the change it generates:

type TypeHasOptional = {
  foo: string;
};

after the change it generates:

type TypeHasOptional = {
  foo?: string;
};

Type with a getter

code:

export type TypeHasGetter = {
  get foo(): string | undefined;
};

before the change it generates:

type TypeHasGetter = {
  get foo
  foo: undefined | string;
};

afterward:

type TypeHasGetter = {
  get foo(): undefined | string;
};

Type with a setter

code:

export type TypeHasSetter = {
  set foo(value: string | undefined);
};

before the change it generates:

type TypeHasSetter = {
  set foo foo: void;
};

afterward:

type TypeHasSetter = {
  set foo(value: undefined | string): void;
};

Copy link

vercel bot commented Apr 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
typedoc-plugin-markdown ⬜️ Ignored (Inspect) Visit Preview Apr 14, 2025 11:22pm

@normanzb normanzb force-pushed the fix/optional-and-getter-setter branch 3 times, most recently from a83fdde to f3a87d9 Compare April 14, 2025 22:41
@normanzb normanzb force-pushed the fix/optional-and-getter-setter branch from f3a87d9 to 3d718d1 Compare April 14, 2025 23:22
@tgreyuk
Copy link
Member

tgreyuk commented Apr 15, 2025

Thanks - looks good.

@tgreyuk tgreyuk merged commit db7188a into typedoc2md:main Apr 15, 2025
3 checks passed
@github-actions github-actions bot mentioned this pull request Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants