Shiki Twoslash Test

Sample page testing if twoslash works or not


function CustomLink(props) {
  const isRelative = props.href?.startsWith("/") ?? false;
 
  if (isRelative) {
    return (
      <Link href={props.href}>
        <a {...props} />
      </Link>
    );
  }
 
  return <a {...props} target="_blank" />;
}
function CustomLink(props) {
  const isRelative = props.href?.startsWith("/") ?? false;
 
  if (isRelative) {
    return (
      <Link href={props.href}>
        <a {...props} />
      </Link>
    );
  }
 
  return <a {...props} target="_blank" />;
}
{ "json": true }
interface IdLabel {
  id: number /* some fields */;
}
interface NameLabel {
  name: string /* other fields */;
}
type NameOrId<T extends number | string> = T extends number
  ? IdLabel
  : NameLabel;
// This comment should not be included
 
// ---cut---
function createLabel<T extends number | string>(idOrName: T): NameOrId<T> {
  throw "unimplemented";
}
 
let a = createLabel("typescript");
for (let x in [0]) console.log(x);

Hello, world!

const a = 1
// - 1
const b = 2
// - 2
const c= 3

Let's talk a bit about a:

// @include: main-1

a can be added to another number

// @include: main-1
// ---cut---
const nextA = a + 13;

You can see what happens when you add a + b

// @include: main-2
// ---cut---
const result = a + b;
//    ^?

Finally here is c:

// @include: main
// ---cut---
c.toString();
{
	remarkPlugins: [[remarkShikiTwoslash, {
		themes: [
			"vendor/pop-n-lock/Pop-N-Lock.json",  "vendor/pop-n-lock/Pop-N-Lock.alexis-black.json"}]
	],
}