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

Undefined is not the same as falsy #4103

Closed
mbursill opened this issue Feb 1, 2024 · 1 comment · Fixed by #4365
Closed

Undefined is not the same as falsy #4103

mbursill opened this issue Feb 1, 2024 · 1 comment · Fixed by #4365
Assignees
Labels
help wanted Issue caused by core project dependency modules or library type:bug A broken experience TypeScript Pull requests that update Javascript code WIP
Milestone

Comments

@mbursill
Copy link

mbursill commented Feb 1, 2024

There's an undefined check on route arguments but it's not actually checking for undefined:

image

This causes an issue if the value is anything that would return falsy (0, empty string, false).

@baywet baywet transferred this issue from microsoft/kiota-typescript Feb 1, 2024
@baywet baywet added type:bug A broken experience help wanted Issue caused by core project dependency modules or library TypeScript Pull requests that update Javascript code labels Feb 1, 2024
@baywet baywet added this to the Kiota v1.12 milestone Feb 1, 2024
@baywet
Copy link
Member

baywet commented Feb 1, 2024

Hi @mbursill,
Thanks for using kiota and for reaching out.
I've transferred your issue to the main generation repository.
First off, heads up, with the upcoming version of kiota, the generated code in TypeScript is changing significantly.
The API surface for the application will remain the same, but the fluent API surface moving from classes to interfaces + proxy + constants to significantly reduce the bundle size. (~44%)
You can try this by using the recent pre-release (make sure you update your kiota dependencies as well)

Lastly, the code that emits that check, is located here in case you'd like to submit a pull request.

writer.WriteLine($"if(!{parameterName}) throw new Error(\"{parameterName} cannot be undefined\");");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue caused by core project dependency modules or library type:bug A broken experience TypeScript Pull requests that update Javascript code WIP
Projects
Archived in project
2 participants