Skip to content

chore(TypeScript): avoid ts-ignore#1190

Merged
Haroenv merged 4 commits intomasterfrom
chore/helpers-tsignore
Oct 12, 2020
Merged

chore(TypeScript): avoid ts-ignore#1190
Haroenv merged 4 commits intomasterfrom
chore/helpers-tsignore

Conversation

@Haroenv
Copy link
Copy Markdown
Contributor

@Haroenv Haroenv commented Sep 7, 2020

  • addMethods with as
  • updateApiKey with type guard
  • browseRules & browseSynonyms with as any (the key exists, but isn't supposed to be shown to the user, thus isn't in the type

- addMethods with `as`
- updateApiKey with type guard
- browseRules & browseSynonyms with `as any` (the key exists, but isn't supposed to be shown to the user, thus isn't in the type
@Haroenv Haroenv requested a review from yannickcr September 7, 2020 13:42
@Haroenv Haroenv marked this pull request as draft September 7, 2020 13:42
for some reason if you do let x = something, you can't change the type anymore in a reassignment, except if you return directly, since that makes a new type
@Haroenv Haroenv marked this pull request as ready for review September 7, 2020 15:28
'maxQueriesPerIPPerHour',
'maxHitsPerQuery',
];
] as const;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just curiosity, there's no mutation on apiKeyFields below, and why as const?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

without as const, the type of updatedField lower is string, not the actual field values

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah I didn't know. Thanks!

Copy link
Copy Markdown
Contributor

@eunjae-lee eunjae-lee left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@Haroenv Haroenv merged commit 5207d68 into master Oct 12, 2020
@Haroenv Haroenv deleted the chore/helpers-tsignore branch October 12, 2020 12:41
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