I have a Quasar 2 project using Typescript running in Node 14, the production is published in Windows Server but I'm working locally in Ubuntu Desktop 22.04 LTS with exact same workspace configuration. I had the following code:
<template>
<q-input
v-model="obj.prop"
:rules="[ val => valid( obj.prop as number ) || 'Error' ]"
/>
</template>
<script lang="ts">
export default defineComponent( {
.
.
.
data: () => ( {
obj: { prop: 0 as number | null },
} ),
methods: {
valid( val: number ): boolean {
return val > 0;
},
},
} );
</script>
But for some reason that is compiling fine for me on Ubuntu but not for Windows which is returning the following:
In order to avoid it I changed with the following code:
<q-input
v-model="obj.prop"
:rules="[ val => valid( obj.prop ) || 'Error' ]"
/>
valid( val: number | null ): boolean {
return val > 0;
}
My question is why is it working on Linux Ubuntu the first way but no in Windows? I don't want to use Windows not even create a workspace there. How can I compile in Linux exact the same way Windows does in order to see those errors? I know about WSL 2 but I think it is not the same. It is supposed to be compile exactly the same for any OS, so, I'm confused.
My tsconfig.json
file:
{
"extends": "@quasar/app/tsconfig-preset",
"compilerOptions": {
"jsx": "preserve",
"baseUrl": ".",
"allowSyntheticDefaultImports": true,
"lib": [ "DOM", "ES2019.Array" ],
}
}
I already solved, I want to know why it is happening and how to avoid it with my current workspace configuration. Because it took me a lot of time compile it on every OS configuration