Vyriy Typescript Config
@vyriy/typescript-config is a shared TypeScript configuration package for Vyriy projects.
The goal of this package is simple: keep TypeScript settings consistent across applications, libraries, examples, and internal packages without copying the same tsconfig.json options again and again.
Instead of configuring every project from scratch, each package can extend the shared config and override only the options that are specific to that package.
Installation
Install the shared config together with TypeScript:
yarn add @vyriy/typescript-config typescript
Basic usage
Create a tsconfig.json file and extend the shared Vyriy config:
{
"extends": "@vyriy/typescript-config/index.json",
"compilerOptions": {
"noEmit": false
},
"include": ["index.ts"]
}
In this example, noEmit is set to false because we want TypeScript to generate JavaScript output.
For type-check-only workflows, libraries, tests, or CI validation, a project may use a different value depending on its build strategy.
Example TypeScript file
Create a simple index.ts file:
type User = {
id: number;
name: string;
email: string;
isActive: boolean;
};
type FormatUser = (user: User) => string;
const formatUser: FormatUser = (user) => {
const status = user.isActive ? 'active' : 'inactive';
return `${user.name} <${user.email}> is ${status}`;
};
const users: User[] = [
{
id: 1,
name: 'Evheniy',
email: 'evheniy@example.com',
isActive: true,
},
{
id: 2,
name: 'Anna',
email: 'anna@example.com',
isActive: false,
},
];
for (const user of users) {
console.log(formatUser(user));
}
This small example shows a few basic TypeScript features:
- a typed object model with
User; - a function type with
FormatUser; - type-safe function arguments;
- a typed array of users;
- JavaScript output generated by the TypeScript compiler.
Build with TypeScript
Run the TypeScript compiler:
npx tsc
After compilation, TypeScript generates the JavaScript file according to the active compiler options.
You can inspect the generated file:
cat index.js
Output:
'use strict';
const formatUser = (user) => {
const status = user.isActive ? 'active' : 'inactive';
return `${user.name} <${user.email}> is ${status}`;
};
const users = [
{
id: 1,
name: 'Evheniy',
email: 'evheniy@example.com',
isActive: true,
},
{
id: 2,
name: 'Anna',
email: 'anna@example.com',
isActive: false,
},
];
for (const user of users) {
console.log(formatUser(user));
}
Run compiled JavaScript
Run the compiled JavaScript file with Node.js:
node index.js
Output:
Evheniy <evheniy@example.com> is active
Anna <anna@example.com> is inactive
Why shared TypeScript config?
A shared TypeScript config helps keep projects predictable.
It is especially useful when a codebase contains many packages, examples, workspaces, or reusable libraries. Each project can follow the same baseline rules while still keeping the freedom to override local build options.
For Vyriy projects, this keeps TypeScript configuration calm, explicit, and reusable.
Documentation
See the TypeScript config API documentation.