D
Deno

help

Deno type enforcement

MMqx7/12/2023
Hey, I have a question about the type checking.
function logging(message : number) {
console.log(message);
}

logging(“Hello”);
function logging(message : number) {
console.log(message);
}

logging(“Hello”);
This should throw an error when trying to run it, but apparently it does not. But why? We tried using the tsc compiler from Node and it clearly throws an error, saying that the type string is not assignable to type number. Is there something I need to change in the config for Deno to get the same error result? Thanks ~Mqx Ohh found out that type checking is off by default and I need to use the —check flag

Looking for more? Join the community!