DenoDDeno
Powered by
MqxM
Deno•3y ago•
1 reply
Mqx

Deno type enforcement

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
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

deno publish / slow type
foobarFfoobar / help
15mo ago
Weird Deno Type Safety
CrypticCCryptic / help
17mo ago
Deno KV Type Error
mostprodevMmostprodev / help
3y ago
deno_bindgen type error: deno-ts(2345)
abiAabi / help
3y ago