-
Notifications
You must be signed in to change notification settings - Fork 257
Convert @bugsnag/core/lib/metadata-delegate to TypeScript #2437
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: integration/typescript
Are you sure you want to change the base?
Convert @bugsnag/core/lib/metadata-delegate to TypeScript #2437
Conversation
add: (state: { [key: string]: any }, section: string, keyOrObj?: any, maybeVal?: any) => any | ||
get: (state: { [key: string]: any }, section: string, key?: any) => any | ||
clear: (state: { [key: string]: any }, section: string, key?: any) => any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just double check what these instances of any
should be? for example key
looks like it should only be string
or undefined
according to the get
function, and section
should probably be unknown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked it's usage in other parts of the code. So we use metadataDelegate
in client.ts
and event.ts
. Since these files are already converted to TS, I took them as a source of possible types.
Based on what you're wrote I will change the type of key
to string | undefined
and in client.ts
too.
But the section
is always string
🤔
interface MetadataDelegate { | ||
add: (state: { [key: string]: any }, section: string, keyOrObj?: object | string, maybeVal?: any) => any | ||
get: (state: { [key: string]: any }, section: string, key?: string | undefined) => any | ||
clear: (state: { [key: string]: any }, section: string, key?: string | undefined) => any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the question mark in key?: string
also allows for undefined
so that's probably fine as it was.
Goal
Convert @bugsnag/core/lib/metadata-delegate to TypeScript
Testing
Covered by existing end to end and unit tests