Skip to content
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

Merged
merged 9 commits into from
Dec 2, 2020
Merged

feat: add typescript types #112

merged 9 commits into from
Dec 2, 2020

Conversation

suevalov
Copy link
Contributor

@suevalov suevalov commented Dec 1, 2020

@@ -1,5 +1,7 @@
import copy from 'fast-copy'
import qs from 'qs'
import type { AxiosStatic } from 'axios'
Copy link

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.

Copy link
Contributor Author

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

Copy link

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?

Copy link
Member

@marcolink marcolink left a 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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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

package.json Outdated Show resolved Hide resolved
@suevalov suevalov merged commit 374933a into master Dec 2, 2020
@suevalov suevalov deleted the convert-repo-to-typescript branch December 2, 2020 15:48
@ghost
Copy link

ghost commented Dec 2, 2020

🎉 This PR is included in version 6.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ghost ghost added the released label Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants