-
Notifications
You must be signed in to change notification settings - Fork 656
Better TOML types #6656
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
base: main
Are you sure you want to change the base?
Better TOML types #6656
Conversation
these are the types that may come out of a toml parser, not the types that may be put in a toml serializer inspired by type-fest's Json types
@@ -0,0 +1,4 @@ | |||
export type TOMLTable = {[Key in string]: TOMLValue} & {[Key in string]: TOMLValue|undefined}; |
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.
We'd prefer the capitalization of TomlTable
. See https://docs.deno.com/runtime/contributing/style_guide/#naming-convention
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 second part {[Key in string]: TOMLValue|undefined}
looks strange to me. Is it possible for key to be undefined? Is that spec compliant?
@@ -131,18 +132,21 @@ export class Scanner { | |||
// Utilities | |||
// ----------------------- | |||
|
|||
function success<T>(body: T): Success<T> { | |||
function success<T extends TOMLValue|void>(body: T): Success<T> { |
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.
Why |void
part necessary?
Run |
We currently don't accept a new feature directly, but we'd like to accept it as unstable feature first (See https://github.com/denoland/std/blob/main/.github/CONTRIBUTING.md#suggesting-a-new-feature ) Let's keep the return type of |
for (const parse of parsers) { | ||
const result = parse(scanner); | ||
if (result.ok) return result; | ||
} | ||
return failure(); | ||
}; | ||
}) as unknown as 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.
This needs // deno-lint-ignore no-explicit-any
directive before this line to pass lint check. See the deno lint
output
No description provided.