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

[Bug] Typescript error in organization.fetch() "An argument for 'force' was not provided." #232

Open
louh opened this issue Dec 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@louh
Copy link

louh commented Dec 17, 2024

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

@louh louh added the bug Something isn't working label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant