gitbeaker
gitbeaker copied to clipboard
Gitlab service camelization types not aligned with Gitlab camelization type
Description
I couldn't think of a plainer way of titling this. The Gitlab class accepts a generic flag for camelization, and also infers it from the camelize
option passed to the constructor. However, while the behavior of the services is correct by consuming that true|false
configuration, the TypeScript types for those services and the data they return continue to indicate no camelization, regardless of the configuration.
- Node.js version: 16.15.1
- Gitbeaker version: 35.7.0
- Gitbeaker release (cli, node, browser, core, requester-utils): core
- OS & version: macos 12.4
Steps to reproduce
- Create an instance of the Gitlab client with the
camelize
option set totrue
. - Observe the TypeScript types of any Gitlab service—e.g.
client.Groups
. - Notice that the "camelize" portion of the types do not match.
Expected behaviour
import { Gitlab } from '@gitbeaker/node';
const client = new Gitlab<true>({camelize: true})
// typeof client === Gitlab<true>
// typeof client.Groups === Groups<true>
Actual behaviour
import { Gitlab } from '@gitbeaker/node';
const client = new Gitlab<true>({camelize: true})
// typeof client === Gitlab<true>
// typeof client.Groups === Groups<false> (will camelize, but types say otherwise)
Possible fixes
I tired to find an easy fix. But I haven't learned TypeScript well enough to suggest a solution. Sorry.
Checklist
- [x] I have checked that this is not a duplicate issue.
- [x] I have read the documentation.
I search the open issues and pull requests, but did not see any existing issue related to this. If I missed it, I apologize, and this one can absolutely be closed.
Good catch! Ill give it a look
Ah, i think the reason why this was acting weird is because the generic variable isnt supposed to be used. Its only there to allow for dynamic typing. If you leave out the generic variable, it should work as intended.