pinojs/pino

Consideration: Auto completion for level option

Closed this issue · 2 comments

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",

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

Happy to bump TypeScript!

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.