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

refactor: add autocomplete for ExchangeType #109

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

mephju
Copy link
Contributor

@mephju mephju commented Mar 11, 2024

No description provided.

@ThomasSarlin ThomasSarlin self-requested a review April 10, 2024 08:45
Copy link
Contributor

@ThomasSarlin ThomasSarlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me,

@ThomasSarlin ThomasSarlin merged commit 57a2575 into cloudamqp:main Apr 10, 2024
@carlhoerberg
Copy link
Member

eslint didn't like this:

/home/runner/work/amqp-client.js/amqp-client.js/src/amqp-channel.ts
  866:81  error  Don't use `{}` as a type. `{}` actually means "any non-nullish value".
- If you want a type meaning "any object", you probably want `object` instead.
- If you want a type meaning "any value", you probably want `unknown` instead.
- If you want a type meaning "empty object", you probably want `Record<string, never>` instead.
- If you really want a type meaning "any non-nullish value", you probably want `NonNullable<unknown>` instead  @typescript-eslint/ban-types

what was your intention @mephju? I don't see how this "adds autocompletetion".

@mephju
Copy link
Contributor Author

mephju commented Jul 17, 2024

Hello @carlhoerberg

It's a well known TS trick to workaround the issue that literal strings are also assignable to string (which is the reason for lack of autocomplete).
With this trick you get the autocomplete for the union but you are still able to assign any string you like.

Please take a look here:
https://stackoverflow.com/questions/74467392/autocomplete-in-typescript-of-literal-type-and-string
and here
microsoft/TypeScript#29729

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.

3 participants