Skip to main content

Typesafe prompt construction for LLM and image inference with zod-parsed results.

This package works with Node.js, Deno, BunIt is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
94%
Published
2 days ago (0.9.2)
type alias ExtractPlaceholders

A utility type that finds all curly-brace placeholders within a string and returns them as a union type. e.g. "Give {{thing}} to {{person}}" returns the type ("thing" | "person")

Type Parameters

S extends string

Definition

S extends `${infer _Start}{{${infer Param}}}${infer Rest}` ? Param | ExtractPlaceholders<Rest> : never

Add Package

deno add jsr:@schoolai/ts-prompt

Import symbol

import { type ExtractPlaceholders } from "@schoolai/ts-prompt";

---- OR ----

Import directly with a jsr specifier

import { type ExtractPlaceholders } from "jsr:@schoolai/ts-prompt";

Add Package

npx jsr add @schoolai/ts-prompt

Import symbol

import { type ExtractPlaceholders } from "@schoolai/ts-prompt";

Add Package

yarn dlx jsr add @schoolai/ts-prompt

Import symbol

import { type ExtractPlaceholders } from "@schoolai/ts-prompt";

Add Package

pnpm dlx jsr add @schoolai/ts-prompt

Import symbol

import { type ExtractPlaceholders } from "@schoolai/ts-prompt";

Add Package

bunx jsr add @schoolai/ts-prompt

Import symbol

import { type ExtractPlaceholders } from "@schoolai/ts-prompt";