This extension brings TypeScript language server features to YAML files! Write TypeScript code in your YAML and get:
- ✅ Real-time error checking
- ✅ Type validation
- ✅ IntelliSense support
- ✅ Just like in
.tsfiles!
# In VS Code, with this project open:
Press F5This opens the "Extension Development Host" - a new VS Code window with the extension running.
In the new window:
File > Open File > example.yaml
Look for red squiggly lines under:
const num: number = "not a number"← Type error!- The incomplete
Userobject ← Missing property! const status: Status = "invalid"← Invalid value!
🎉 Congratulations! TypeScript is now working in your YAML file!
Create any .yaml file with TypeScript code:
name: My Config
handler:
code: |
interface User {
id: number;
name: string;
email: string;
}
const user: User = {
id: 1,
name: "Alice",
email: "alice@example.com"
};
validation:
script: |
const validateEmail = (email: string): boolean => {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
};
// This will show an error - wrong type!
const result = validateEmail(123);database:
setup: |
type DbConfig = {
host: string;
port: number;
};
const config: DbConfig = {
host: 'localhost',
port: 5432
};button:
onClick: |
const handleClick = (event: MouseEvent): void => {
console.log('Clicked!', event);
};validators:
email: |
const isValid = (email: string): boolean => {
return email.includes('@');
};The extension detects TypeScript code in:
- Values with code-related keys:
code,script,handler,validator, etc. - Explicit markers: Comments like
# typescript: - Heuristics: Any multiline string with TypeScript syntax
- Keywords:
const,let,function,interface,type,class - Type annotations:
: string,: number, etc. - Arrow functions:
=> - Imports/exports
- Generics:
<T>
- Make sure you're in the Extension Development Host window (opened by F5)
- Check the file is actually
.yamlor.yml - Ensure your code has TypeScript-specific syntax (types, interfaces, etc.)
- Try closing and reopening the file
- Check the Debug Console in the main VS Code window
- Look for any error messages
- Try restarting the Extension Development Host (Ctrl+R)
- ✅ You've seen it work with
example.yaml - 📝 Create your own YAML files with TypeScript
- 🎨 Explore more examples in
TUTORIAL.md - 🔧 Learn technical details in
DEVELOPMENT.md - 📦 Package and install locally (see below)
Want to use the extension permanently?
# Package the extension
pnpm run package
# This creates yamlscript-0.0.1.vsix
# Install it:
# 1. Open Extensions panel (Ctrl+Shift+X)
# 2. Click "..." menu
# 3. Choose "Install from VSIX..."
# 4. Select the .vsix fileyamlscript/
├── src/extension.ts ← Main code (327 lines)
├── example.yaml ← Demo file
├── package.json ← Extension manifest
├── README.md ← User docs
├── TUTORIAL.md ← Detailed tutorial
├── DEVELOPMENT.md ← Technical guide
├── SUMMARY.md ← Complete overview
└── CHECKLIST.md ← Testing & deployment
| Feature | Status |
|---|---|
| Error Detection | ✅ Working |
| Type Checking | ✅ Working |
| Real-time Updates | ✅ Working |
| Multiple Blocks | ✅ Working |
| IntelliSense | |
| Go to Definition | ❌ Future |
# Watch mode (auto-compile on changes)
pnpm run watch
# Then press F5 to launch
# Compile once
pnpm run compile
# Lint
pnpm run lint
# Test
pnpm run test
# Package
pnpm run packagetest:
code: |
const x: number = "hello"; // ← Error!test:
code: |
interface Person {
name: string;
age: number;
}
const p: Person = { name: "Bob" }; // ← Error! Missing agetest:
code: |
function greet(name: string): string {
return `Hello, ${name}`;
}
greet(123); // ← Error! Wrong typetest:
code: |
const numbers: number[] = [1, 2, "3"]; // ← Error! Wrong type in array- Use meaningful keys:
code,script,handlerhelp detection - Include type annotations: Makes detection more reliable
- Keep blocks focused: One purpose per code block
- Check
example.yaml: Lots of examples there!
- 📖 Full tutorial:
TUTORIAL.md - 🔧 Technical docs:
DEVELOPMENT.md - 📋 Complete summary:
SUMMARY.md - ✅ Testing guide:
CHECKLIST.md - 💡 Examples:
example.yaml
- Read the docs above
- Check the example file
- Look at the code in
src/extension.ts - Open an issue on GitHub
- Press F5 in VS Code
- Open example.yaml in the new window
- See TypeScript errors in the YAML file
- Mind = Blown 🤯
Made with ❤️ for developers who love type safety everywhere!