Challenge - 5 Problems
Deno TypeScript Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateWhat is the output of this Deno TypeScript code?
Consider this Deno script using TypeScript features. What will it print when run with
deno run?Deno
const greet = (name: string): string => `Hello, ${name}!`; console.log(greet("Deno"));
Attempts:
2 left
💡 Hint
Think about how Deno runs TypeScript files directly without separate compilation.
✗ Incorrect
Deno supports TypeScript natively, so the code runs as expected and prints the greeting with the provided name.
❓ component_behavior
intermediateHow does Deno handle TypeScript imports without extensions?
In Deno, what happens if you import a TypeScript module without specifying the file extension?
Deno
import { add } from "./math"; console.log(add(2, 3));
Attempts:
2 left
💡 Hint
Deno is strict about file extensions in imports.
✗ Incorrect
Deno requires explicit file extensions in import statements, so omitting it causes an error.
📝 Syntax
advancedWhich option correctly uses TypeScript enums in Deno?
Select the code snippet that compiles and runs correctly in Deno with TypeScript enums.
Attempts:
2 left
💡 Hint
Remember how numeric and string enums behave in TypeScript.
✗ Incorrect
Option C accesses a valid enum member by name and prints its numeric value. Option C tries to access by index but prints the name, B mixes string enum with numeric access, D accesses a non-existent member.
🔧 Debug
advancedWhat error does this Deno TypeScript code produce?
Analyze this code and select the error it raises when run with
deno run:Deno
function multiply(a: number, b: number): number {
return a * b;
}
console.log(multiply(5, "3"));Attempts:
2 left
💡 Hint
Consider TypeScript's static type checking before runtime.
✗ Incorrect
Deno's TypeScript compiler detects the type mismatch at compile time and reports a type error.
🧠 Conceptual
expertHow does Deno achieve TypeScript support out of the box?
Which statement best explains how Deno runs TypeScript code without manual compilation steps?
Attempts:
2 left
💡 Hint
Think about how Deno integrates TypeScript support seamlessly.
✗ Incorrect
Deno has a built-in TypeScript compiler that transpiles code to JavaScript on the fly before running it.
