Editor & IDE Integration
Valype provides rich IDE support for .valype.ts
files via:
🥇 VSCode Extension (Recommended)
You can get instant type hints, code completion, and go-to-definition for .valype.ts
files by installing the Valype VSCode extension.
- No manual tsconfig plugin configuration required
- Works out of the box for all
.valype.ts
files
Just search for "Valype" in the VSCode Extensions Marketplace and install.
The extension is also available on openVSX for use in editors like Cursor.
🛠️ TypeScript Plugin (Advanced/Custom)
TypeScript language service plugin that provides IDE support for .valype.ts
files.
Features
- Recognizes
.valype.ts
file extension - Transforms valype code to TypeScript in real-time
- Provides IDE features like type checking, code completion and go-to-definition
- Supports validation, semantic analysis and formatting
Installation
bash
npm install -D @valype/typescript-plugin
bash
yarn add -D @valype/typescript-plugin
bash
pnpm add -D @valype/typescript-plugin
bash
bun add -D @valype/typescript-plugin
Usage
- Configure plugin in tsconfig.json:
json
{
"compilerOptions": {
"plugins": [
{
"name": "@valype/typescript-plugin"
}
]
}
}
Create
.valype.ts
files and start writing valype codeFor VSCode users, ensure you're using the workspace version of TypeScript:
- Open a TypeScript file in VSCode
- Click the TypeScript version number in the status bar
- Select "Use Workspace Version" from the dropdown
Example
typescript
// user.valype.ts
interface User {
name: string
age: number
}
typescript
// use user.valype.ts
import { validateUser, assertUser, isUser, type User } from './user.valype'
const data = {} satisfies User
const result = validateUser(data)
if (isUser(data)) console.log('data is User')
assertUser(data)