Skip to content

refactor: improve Wdk export #101

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

Merged
merged 1 commit into from
Feb 19, 2023
Merged

Conversation

EdJoPaTo
Copy link
Contributor

the Wbk interface has a lot of duplicate types which result in easy errors.
This removes a lot of these duplicates and the exact types of the functions are used.
Minor downside: types like type Url = string get simplified sometimes by TypeScript and look like string afterwards.

This should not breaking as long as no one used simplify or parse as an object (why should someone do that) (look at the tests/general to see what I mean).

very likely conflicts with #100 but this can easily be extended as #100 would only be the change in index.ts with this Pull Request.

@maxlath maxlath merged commit 0b79a89 into maxlath:main Feb 19, 2023
@maxlath
Copy link
Owner

maxlath commented Feb 19, 2023

This should not breaking as long as no one used simplify or parse as an object

Ah yes, that's because, for some reason, when you do import * as parse from './helpers/parse_responses.js', then parse is an object with null as prototype; so when should does its nasty hack to extend the Object prototype, objects built with import/export * are not affected. There is a work-around though: should(parse).be.an.Object()

@EdJoPaTo
Copy link
Contributor Author

I completely removed the src/types/wbk.ts as its now done in src/wikibase-sdk.ts. Your rebase didnt delete that file (probably because of a merge conflict).
Its obsolete now and should be removed as this PR is merged 😇

@EdJoPaTo
Copy link
Contributor Author

There is a work-around though: should(parse).be.an.Object()

It should be this way anyway to be used with Typescripts strict null checks. I have a (messy) local branch for that already 😇

@maxlath
Copy link
Owner

maxlath commented Feb 21, 2023

I now removed src/types/wbk.ts in 41841fa

@EdJoPaTo EdJoPaTo deleted the improve-wdk-export branch February 21, 2023 09:55
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.

2 participants