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

Consideration: Auto completion for level option #1807

Closed
bogeychan opened this issue Sep 12, 2023 · 2 comments · Fixed by #1808
Closed

Consideration: Auto completion for level option #1807

bogeychan opened this issue Sep 12, 2023 · 2 comments · Fixed by #1808

Comments

@bogeychan
Copy link
Contributor

bogeychan commented Sep 12, 2023

Description

The level option doesn't support auto-completion:

pino/pino.d.ts

Line 347 in 9328478

level?: LevelWithSilent | string;

pino_level_no_auto_completion

LiteralUnion makes this possible (without type errors for custom string): microsoft/TypeScript#29729

interface LoggerOptions {
    level?: LevelWithSilent | (string & {});
    // ...
}

pino_level_auto_completion

This would improve the developer experience.

Implementation

However, I don't know if it can be implemented yet, ...

typescript 4.4 is mentioned here (doesn't supports it → there won't be any auto-completion, the behavior should be the same as now):

pino/pino.d.ts

Line 16 in 9328478

// TypeScript Version: 4.4

but version 5.3.1 is used in package.json, this version already supports the technique used in LiteralUnion:

"typescript": "^5.1.3",

@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

Happy to bump TypeScript!

Copy link

github-actions bot commented Nov 3, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants