Open
Description
Current Behavior
When fetching projects from an organization with await organization.fetch('projects');
(see for example this line in documentation) Typescript will throw an error like this:
Expected 2 arguments, but got 1.ts(2554)
transifexApi.d.ts(20, 35): An argument for 'force' was not provided.
(method) JsonApiResource.fetch(relationshipName: string, force: boolean): Promise<JsonApiResource | Collection>
Expected Behavior
As force
is an optional parameter that defaults to false
, the end developer should not be required to provide a value simply to satisfy the typechecker.
Steps to Reproduce
In a TypeScript module working with @transifex/api
package, add this line and you should see the error while typechecking.
const projects = await organization.fetch('projects');
Possible Solution
Update this line in transifexApi.d.ts
so that force
is optional: https://github.com/transifex/transifex-javascript/blob/master/packages/api/src/transifexApi.d.ts#L20
old:
fetch(relationshipName: string, force: boolean): Promise<JsonApiResource | Collection>;
new:
fetch(relationshipName: string, force?: boolean): Promise<JsonApiResource | Collection>;
Possible Implementation
n/a