Typescript Error: "Type 'number' is not assignable to type '0 | 4 | 3 | 2 | 1'."

Topic Labels: Scripting extentions
4879 0
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi there! I found a minor DX issue in the generated Typescript definitions (which are incredibly cool, by the way).

I’ve got a rating field in my base:


When writing scripting to update it, I’ve got an await input.buttonsAsync where each item is has a value and label: { label: "", value: 4 }, etc.

The selected button goes into a payload object that’s eventually passed to table.updateRecordAsync. The actual script works flawlessly, but there’s a TS error:

Type "number" is not assignable to type '0 | 1 | 2 | 3 | 4'


I tried to add a type assertion, but apparently the script input isn’t a TS file. I think the fix is as simple as demoting the Rating type to accept numbers instead of a specific set of numbers.

Not a big deal, since the error doesn’t affect execution, but I figured I’d flag. Thanks!

0 Replies 0