headintheclouddev / typings-suitescript-2.0

TypeScript typings for SuiteScript version 2.0
MIT License
145 stars 92 forks source link

Update redirect.d.ts #286

Closed Extend-Apps closed 3 months ago

Extend-Apps commented 3 months ago

id is optional

MrRob commented 3 months ago

@Extend-Apps I think we've looked at this one before. According to the documentation, id is required, right? The way I normally redirect to a new record is just to set id to null. What are your thoughts?

Extend-Apps commented 3 months ago

I have a solution in production for a while that works great when id is absent, so we know it works.

I know there are other redirects in his library that work the same way.

I'm easy. I'm like you and want things to line up with the documentation.

ShawnTalbert commented 3 months ago

Documentation first, but reality should weigh in because we know the NS docs are far from perfect.

Gut feel for me is to set id to null seems clearer reading than just leaving it out (undefined). However, the current type doesn't include null and since we set strictNullChecks:true in our projects, that would prevent us from setting it to null as-is.

At a minimum, can we add | null to the definition?

MrRob commented 3 months ago

@ShawnTalbert That's a good call. @Extend-Apps can you update the PR to keep it required but add null as an allowed value?