Files
windmill/system_prompts/languages/nativets.md
centdix b40cf80fdd fix: optimize flow lock generation and add rt.d.ts guidance for TS resource types (#8295)
Instruct AI to pass specific flow folder path to `wmill flow generate-locks`
instead of running it on all flows. Also add guidance for TypeScript language
files to check `rt.d.ts` for available resource types before using them.
Re-ran generate.py to propagate changes to all auto-generated files.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:03:21 +00:00

1.7 KiB

TypeScript (Native)

Native TypeScript execution with fetch only - no external imports allowed.

Structure

Export a single async function called main:

export async function main(param1: string, param2: number) {
  // Your code here
  return { result: param1, count: param2 };
}

Do not call the main function.

Resource Types

On Windmill, credentials and configuration are stored in resources and passed as parameters to main.

Use the RT namespace for resource types:

export async function main(stripe: RT.Stripe) {
  // stripe contains API key and config from the resource
}

Only use resource types if you need them to satisfy the instructions. Always use the RT namespace.

Before using a resource type, check the rt.d.ts file in the project root to see all available resource types and their fields. This file is generated by wmill resource-type generate-namespace.

Imports

No imports allowed. Use the globally available fetch function:

export async function main(url: string) {
  const response = await fetch(url);
  return await response.json();
}

Windmill Client

The windmill client is not available in native TypeScript mode. Use fetch to call APIs directly.

Preprocessor Scripts

For preprocessor scripts, the function should be named preprocessor and receives an event parameter:

type Event = {
  kind:
    | "webhook"
    | "http"
    | "websocket"
    | "kafka"
    | "email"
    | "nats"
    | "postgres"
    | "sqs"
    | "mqtt"
    | "gcp";
  body: any;
  headers: Record<string, string>;
  query: Record<string, string>;
};

export async function preprocessor(event: Event) {
  return {
    param1: event.body.field1,
    param2: event.query.id
  };
}