Skip to main content

Built-in TypeScript support

Deno natively understands TypeScript code with no compiler to configure. Start writing code in .ts files, and the runtime will work with them just fine.

Edit on Github
Define an interface in TypeScript
interface Person {
  name: string;
  age: number;
}
Provide a typed input to a function
function greet(person: Person) {
  return "Hello, " + person.name + "!";
}
Everything works with zero config!
console.log(greet({ name: "Alice", age: 36 }));

Run this example locally using the Deno CLI:

deno run https://docs.deno.com/examples/scripts/typescript_support.ts

Additional resources

Did you find what you needed?

Privacy policy