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

chore: stricter return type in ConfigStore.get(...) #5953

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

vvagaytsev
Copy link
Collaborator

What this PR does / why we need it:

The signature get<S extends keyof I<T>, K extends keyof I<T>[S]>(section: S, key: K) may return undefined because the key parameter is a dynamic value, that might not exist in the config store.

See CloudApi.getStoredAuthToken().
It can return undefined and we check it in CloudApi.factory().

Which issue(s) this PR fixes:

Prevents potential runtime undefined-errors.

Special notes for your reviewer:

I figured this out while reviewing #5502.

The signature `get<S extends keyof I<T>, K extends keyof I<T>[S]>(section: S, key: K)`
may return `undefined` because the `key` parameter is a dynamic value,
that might not exist in the config store.

See `CloudApi.getStoredAuthToken()`.
It can return `undefined` and we check it in `CloudApi.factory()`.
@vvagaytsev vvagaytsev requested a review from stefreak April 18, 2024 07:56
@vvagaytsev vvagaytsev added this pull request to the merge queue Apr 18, 2024
Merged via the queue into main with commit ed67a2f Apr 18, 2024
40 checks passed
@vvagaytsev vvagaytsev deleted the chore/stricter-return-type-in-config-storage branch April 18, 2024 09:37
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