Type error when using RescriptCore flag

I was going through the book “Introducing Rescript” and trying out the following code:

@val external process : 'a = "process"
Js.log(`Hello, ${process["argv"][2]}`)
                 ~~~~~~~~~~~~~~~~~~

If I enable RescriptCore I get the error:

This has type: option<'a>
Somewhere wanted: string

The type hint for process[“argv”][2] is {.."argv": array<'a>}

But if I disable RescriptCore there is no error and the type hint shows process[“argv”][2] is {.."argv": array<string>}

So I’m curious as to what about RescriptCore would cause the type to be different? I’m using Rescript v10 (also tried v10.1.4).

This is likely because when you have ReScript Core open it’ll call a getter function (Array.get) which returns an option rather throwing if out of bounds.

Ah, okay. That makes sense.