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 type exports #425

Merged
merged 1 commit into from
Aug 27, 2019
Merged

feat: Add type exports #425

merged 1 commit into from
Aug 27, 2019

Conversation

ksaaskil
Copy link
Contributor

  • Exports the types of Gitlab, UsersBundle, etc. using the built-in InstanceType defined as follows:
/**
 * Obtain the return type of a constructor function type
 */
type InstanceType<T extends new (...args: any) => any> = T extends new (...args: any) => infer R ? R : any;
import * as gitlab from 'gitlab'
const aaa = new gitlab.Gitlab({ host:'foo', token:'bar' });
const bbb : WHAT_AM_I??? = aaa;
  • Not sure if this could break anything, just a suggestion ¯_(ツ)_/¯

- Add type exports.
- Add types to bundle unit tests.
@jetersen
Copy link
Contributor

Shouldn't import be import { Gitlab } from 'gitlab'

@ksaaskil
Copy link
Contributor Author

ksaaskil commented Aug 27, 2019

Shouldn't import be import { Gitlab } from 'gitlab'

That would definitely work, I just copy-pasted the code in issue description from issue #384

@ksaaskil ksaaskil changed the title Add type exports feat: Add type exports Aug 27, 2019
@jdalrymple jdalrymple merged commit 5b41af0 into jdalrymple:master Aug 27, 2019
@jdalrymple
Copy link
Owner

🎉 This PR is included in version 10.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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