-
Notifications
You must be signed in to change notification settings - Fork 32
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
♻️ Use bigint for long types in mcdoc #1487
base: main
Are you sure you want to change the base?
Conversation
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.
Some of these unsafe casts make me a bit nervous, but I don't immediately see a clean way to get rid of them
@@ -498,7 +500,8 @@ function checkShallowly<T>( | |||
if ( | |||
typeDef.valueRange | |||
&& simplifiedInferred.kind === 'literal' | |||
&& typeof simplifiedInferred.value.value === 'number' | |||
&& simplifiedInferred.value.kind !== 'string' | |||
&& simplifiedInferred.value.kind !== 'boolean' |
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.
There are probably a few other places, maybe in attributes, where this pattern was used
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.
Pretty sure that's untrue. This one I cought because it caused a build error, so I don't see why this wouldn't happen in other places.
@@ -1001,7 +1009,7 @@ function convertLiteralValue(node: LiteralTypeValueNode, ctx: McdocBinderContext | |||
kind: convertLiteralNumberSuffix(suffix, ctx) | |||
?? (value.type === 'integer' ? 'int' : 'double'), | |||
value: value.value, | |||
} | |||
} as LiteralValue |
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 PR adds a couple of these unsafe casts, if you find a way to get rid of them that would be nice
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.
In some places, you can do
return kind === 'long'
? { kind, value }
: { kind, value }
to satisfy the type checker, but it's also a bit weird ¯\_(ツ)_/¯
No description provided.