Skip to content

add types#30

Merged
mcollina merged 4 commits intofastify:masterfrom
goto-bus-stop:types
Apr 6, 2021
Merged

add types#30
mcollina merged 4 commits intofastify:masterfrom
goto-bus-stop:types

Conversation

@goto-bus-stop
Copy link
Copy Markdown
Contributor

Adds typescript types for the secure-json-parse functions.

The any return types are not ideal (it could be better to return unknown and force an explicit cast) but this way it's the same as JSON.parse().

Checklist

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test test for the types using tsd?

@goto-bus-stop
Copy link
Copy Markdown
Contributor Author

yep--turns out i made a mistake in the declarations the first time round! should be accurate now.

@goto-bus-stop
Copy link
Copy Markdown
Contributor Author

goto-bus-stop commented Apr 2, 2021

looks like tsd doesn't support <10.x (even the versions that claim to support 8.x pull in dependencies that no longer do).
I don't know if there's precedent in the fastify org for this, I could add an npm run test-legacy for that doesn't run tsd so node 6 and 8 can still be tested on CI. does that sound good?

@mcollina
Copy link
Copy Markdown
Member

mcollina commented Apr 2, 2021

good for me!

Copy link
Copy Markdown

@L2jLiga L2jLiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit a828ae6 into fastify:master Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants