quokka icon indicating copy to clipboard operation
quokka copied to clipboard

Quokka not recognising inline ts target compilerOption

Open Naxos84 opened this issue 7 months ago • 0 comments

Issue description or question

Is this issue related to Quokka not outputting the expected results of your code?: No

I'm expecting Quokka to throw an error in the following case.

Sample code

({
    ts: {
        compilerOptions: {
            target: "es5"
        }
    }
})

const arr:{state: string}[] = [{state: "error"}, {state: "ok"}, {state: "warning"}];

const a = arr.find(a =>  a.state === "ok");

console.log(a);

When compiling the same code (without the inline quokka configuration) with tsc -t es5 myFile.ts I receive an error.

test.ts:3:15 - error TS2550: Property 'find' does not exist on type '{ state: string; }[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

3 const a = arr.find((a) => a.state === "ok");
                ~~~~


Found 1 error in test.ts:3

Sample repository link

I don't have a sample repo because I'm just using it inline

Quokka.js Console Output

{ state: 'ok' } ​​​​​at ​​​​​​​​a​​​ ​quokka.ts:13:1​

Code editor version

Visual Studio Code v1.91.1

OS name and version

Windows

Installed Typescript version

5.4.5

Naxos84 avatar Jul 31 '24 10:07 Naxos84