-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: add typescript types #112
Conversation
@@ -1,5 +1,7 @@ | |||
import copy from 'fast-copy' | |||
import qs from 'qs' | |||
import type { AxiosStatic } from 'axios' |
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.
I'd recommend to hide all the Axios* names/types behind re-exported ones to make potential switches easier.
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.
Not sure if we need to do it now, realistically if we mostly likely switch from axios
to redaxios
and have exactly the same API
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.
Do they export the same types?
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.
Another step towards full TS support of all SDKs 🎉
@@ -14,7 +15,8 @@ function deepFreeze (object) { | |||
return Object.freeze(object) | |||
} | |||
|
|||
export default function freezeSys (obj) { | |||
export default function freezeSys<T>(obj: T): 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.
I think you could change the type to mark the sys
portion as Readonly
so TS is aware of the freeze, but it would be of course more of a nice to have.
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.
I'd rather keep it simple now to avoid unnecessary complications of types in contentful-management
🎉 This PR is included in version 6.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
types
field topackage.json