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

fix: not working for multi line union types #17

Merged
merged 1 commit into from
Dec 23, 2020

Conversation

danielpza
Copy link
Collaborator

closes #16

@hosseinmd
Copy link
Owner

Good stuff. Thanks.

@hosseinmd hosseinmd merged commit fee81f6 into hosseinmd:master Dec 23, 2020
@hosseinmd
Copy link
Owner

release: 0.2.9 31ba3e4

@sgtpep
Copy link

sgtpep commented Jan 12, 2021

Hey! I've run into an issue with this change. Once the @type is formatted this way (no symbols after @type { on the same line), typescript treats such a type as any (ignores it?). Had to stick my dependency to 0.2.8 because of that.

@hosseinmd
Copy link
Owner

Can I see your code?

@sgtpep
Copy link

sgtpep commented Jan 12, 2021

/**
 * @type {
 *   | ((
 *       foo: Foo,
 *       bar: Bar,
 *       baz: Baz,
 *       qux: Qux,
 *     ) => void)
 *   | undefined}
 */
let orderMocked;

/** @type {(mockOrdering: typeof orderMocked) => void} */
const mockOrdering = (mockOrdering) => {};

/** @type {Parameters<typeof mockOrdering>[0]} */
const handleOrdering = (
  foo,
  bar,
  baz,
  qux
) => {}

Maybe it's a bug in TypeScript, but if there's a newline after @type {, it throws an error that arguments of the last function are of type any.

@hosseinmd
Copy link
Owner

hosseinmd commented Jan 12, 2021

Yes you are right. I saw that bug, I think this change should be reverted.

But I need to know what @danielpza think.

@danielpza
Copy link
Collaborator Author

danielpza commented Jan 12, 2021

But I need to know what @danielpza think.

agree (with the revert).

hosseinmd added a commit that referenced this pull request Jan 12, 2021
hosseinmd added a commit that referenced this pull request Jan 12, 2021
hosseinmd added a commit that referenced this pull request Jan 12, 2021
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.

Not formatting typescript union correctly
3 participants