← back

Shiki Twoslash

We’re using Shiki Twoslash to add compiler information to TypeScript and JavaScript code snippets.

ts
// @filename: maths.ts
export function absolute(num: number) {
if (num < 0) return num * -1;
return num;
}
 
// @filename: index.ts
import { absolute } from "./maths.js";
const value = absolute(-1);
ts
// @filename: maths.ts
export function absolute(num: number) {
if (num < 0) return num * -1;
return num;
}
 
// @filename: index.ts
import { absolute } from "./maths.js";
const value = absolute(-1);

Pretty neat, isn’t it?

ts
const welcome = "Cześć";
const words = welcome.contains(" ");
Property 'contains' does not exist on type '"Cześć"'.2339Property 'contains' does not exist on type '"Cześć"'.
ts
const welcome = "Cześć";
const words = welcome.contains(" ");
Property 'contains' does not exist on type '"Cześć"'.2339Property 'contains' does not exist on type '"Cześć"'.