ajv-keywords
ajv-keywords copied to clipboard
Typeof bigint
Could you please add bigint to the typeof keyword?
I think it would require adding bigint support to ajv... It could potentially be limited just to this keyword, if you make the PR we can assess if it is ok as an isolated change.
Why?
typeof just checks types, without coercions or other things.
I think it will be enough to add bigint here:
const TYPES = ["undefined", "string", "number", "object", "function", "boolean", "symbol"]
Why?
well, because none of the keywords you expect to work with integer would work with bigint... Also, it seems to have a limited utility as JSON.parse cannot be configured to parse as bigint.
But I don't mind adding it to typeof here only, with the disclaimer in the docs that none of the other keywords that apply to numbers/integers apply to bigint...
I will come back to this issue a bit later.
On 20.05.2022 09:42, Evgeny Poberezkin wrote:
Why?well, because none of the keywords you expect to work with integer would work with bigint... Also, it seems to have a limited utility as JSON.parse cannot be configured to parse as bigint.
But I don't mind adding it to typeof here only, with the disclaimer in the docs that none of the other keywords that apply to numbers/integers apply to bigint...
— Reply to this email directly, view it on GitHub https://github.com/ajv-validator/ajv-keywords/issues/251#issuecomment-1132531945, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH2MSGKWYQGC2R25B4ACHDVK4X3RANCNFSM5NHT5JJQ. You are receiving this because you authored the thread.Message ID: @.***>
Noy actually needed. we decided to not use biginy at all