Skip to content

fix(typing): Fix typing API in CaptureConsle #4879

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

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/integrations/src/captureconsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ export class CaptureConsole implements Integration {
/**
* @inheritDoc
*/
private readonly _levels: typeof CONSOLE_LEVELS = CONSOLE_LEVELS;
private readonly _levels: readonly string[] = CONSOLE_LEVELS;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private readonly _levels: readonly string[] = CONSOLE_LEVELS;
private readonly _levels: typeof CONSOLE_LEVELS[number] = CONSOLE_LEVELS;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thought about that one too but that would still break the API. It was string[] before and doing typeof CONSOLE_LEVELS[number] is stricter than that. We could do that in the major bump however.


/**
* @inheritDoc
*/
public constructor(options: { levels?: typeof CONSOLE_LEVELS } = {}) {
public constructor(options: { levels?: string[] } = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public constructor(options: { levels?: string[] } = {}) {
public constructor(options: { levels?: typeof CONSOLE_LEVELS[number] } = {}) {

if (options.levels) {
this._levels = options.levels;
}
Expand Down