Skip to content

[GS-5825]/provide support for typescript_Engineering Ticket #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
],
"scripts": {
"foreach": "yarn workspaces foreach --no-private --parallel --verbose",
"build:tsc": "tsc --build --verbose",
"build": "yarn run build:tsc",
"build:watch": "concurrently --raw --kill-others 'tsc --build --verbose --watch --inlineSourceMap'",
"build:clean": "tsc --build --clean && yarn workspaces foreach exec rm -rf dist",
"version": "yarn changeset version && yarn install --mode=update-lockfile",
"publish": "yarn foreach npm publish --tolerate-republish",
"postinstall": "yarn foreach run prepack",
Expand All @@ -16,6 +20,7 @@
"@changesets/cli": "^2.26.0",
"@flex-development/toggle-pkg-type": "^1.0.1",
"@vitest/coverage-v8": "^2.1.1",
"concurrently": "^9.1.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocker: This package is not being used so it can be removed.

"danger": "^11.2.3",
"duti": "^0.15.2",
"esbuild": "^0.17.5",
Expand All @@ -25,6 +30,8 @@
"glob": "^8.1.0",
"minimist": "^1.2.7",
"prettier": "^2.8.3",
"tsx": "^4.19.3",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocker: This package is not being used so it can be removed.

"typescript": "^5.7.3",
"vitest": "^2.1.1"
},
"packageManager": "[email protected]"
Expand Down
42 changes: 42 additions & 0 deletions packages/client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
//Inherits settings from ../tsconfig.all.jsonc which is at root level
"extends": ["../../tsconfig.all.jsonc"],

//Tells TypeScript to only compile files inside the src/ folder and its subdirectories.
//It includes .ts, .tsx, .js, and .jsx
"include": ["src/**/*"],

//compilerOptions inherited from tsconfig.all.jsonc are overridden here.
// i have taken reference from spark/web compilerOptions.In that also we are overridding
"compilerOptions": {
//Provides Node.js global types and includes types for Vitest which is used by test files
"types": ["node", "vitest"],

"outDir": "dist", // Output directory for compiled files

//same as what we do in Spark , a node_modules folder at root level , with in that a subfolder named 'client'
"tsBuildInfoFile": "../../node_modules/.buildinfo/client",

//Allows TypeScript to compile JavaScript files
"allowJs": true,

//Disables type checking on .js files.
"checkJs": false,

//Ensures that functions always return a value.for example there is whole code of function wrapped under IF statment,
//then it will throw Error: Not all code paths return a value.
"noImplicitReturns": true,

//Forces explicit undefined checks when accessing arrays or objects.
//for example let x = arr[0]; // Error: x might be undefined.
//to fix this let x: number[] | undefined or let x = arr[0] as number;
"noUncheckedIndexedAccess": true,

//Ensures function parameters are used.// Error: 'name' is unused.
"noUnusedParameters": true,

"strict": true,

"isolatedModules": true
}
}
49 changes: 49 additions & 0 deletions packages/export/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
//Inherits settings from ../tsconfig.all.jsonc which is at root level
"extends": ["../../tsconfig.all.jsonc"],

//Tells TypeScript to only compile files inside the src/ folder and its subdirectories.
//It includes .ts, .tsx, .js, and .jsx
"include": ["src/**/*"],

//compilerOptions inherited from tsconfig.all.jsonc are overridden here.
// i have taken reference from spark/web compilerOptions.In that also we are overridding
"compilerOptions": {
//Provides Node.js global types and includes types for Vitest which is used by test files
"types": ["node", "vitest"],

"outDir": "dist", // Output directory for compiled files

//same as what we do in Spark , a node_modules folder at root level , with in a subfolder named 'export'
"tsBuildInfoFile": "../../node_modules/.buildinfo/export",

//Allows TypeScript to compile JavaScript files
"allowJs": true,

//Disables type checking on .js files.
"checkJs": false,

//Ensures that functions always return a value.for example there is whole code of function wrapped under IF statment,
//then it will throw Error: Not all code paths return a value.
"noImplicitReturns": true,

//Forces explicit undefined checks when accessing arrays or objects.
//for example let x = arr[0]; // Error: x might be undefined.
//to fix this let x: number[] | undefined or let x = arr[0] as number;
"noUncheckedIndexedAccess": true,

//Ensures function parameters are used.// Error: 'name' is unused.
"noUnusedParameters": true,

//strict it self holds 6 different type of checks
//strictNullChecks-Error: Type 'null' is not assignable to 'string'
//noImplicitAny-Error: Parameter 'name' implicitly has an 'any' type
//strictFunctionTypes-Error: Type '(age: number) => void' is not assignable to type '(name: string) => void'
//strictBindCallApply-
//strictPropertyInitialization-
//noImplicitThis-
"strict": true,

"isolatedModules": true
}
}
49 changes: 49 additions & 0 deletions packages/provider-elasticsearch/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
//Inherits settings from ../tsconfig.all.jsonc which is at root level
"extends": ["../../tsconfig.all.jsonc"],

//Tells TypeScript to only compile files inside the src/ folder and its subdirectories.
//It includes .ts, .tsx, .js, and .jsx
"include": ["src/**/*"],

//compilerOptions inherited from tsconfig.all.jsonc are overridden here.
// i have taken reference from spark/web compilerOptions.In that also we are overridding
"compilerOptions": {
//Provides Node.js global types and includes types for Vitest which is used by test files
"types": ["node", "vitest"],

"outDir": "dist", // Output directory for compiled files

//same as what we do in Spark , a node_modules folder at root level , with in a subfolder named 'provider-elasticsearch'
"tsBuildInfoFile": "../../node_modules/.buildinfo/provider-elasticsearch",

//Allows TypeScript to compile JavaScript files
"allowJs": true,

//Disables type checking on .js files.
"checkJs": false,

//Ensures that functions always return a value.for example there is whole code of function wrapped under IF statment,
//then it will throw Error: Not all code paths return a value.
"noImplicitReturns": true,

//Forces explicit undefined checks when accessing arrays or objects.
//for example let x = arr[0]; // Error: x might be undefined.
//to fix this let x: number[] | undefined or let x = arr[0] as number;
"noUncheckedIndexedAccess": true,

//Ensures function parameters are used.// Error: 'name' is unused.
"noUnusedParameters": true,

//strict it self holds 6 different type of checks
//strictNullChecks-Error: Type 'null' is not assignable to 'string'
//noImplicitAny-Error: Parameter 'name' implicitly has an 'any' type
//strictFunctionTypes-Error: Type '(age: number) => void' is not assignable to type '(name: string) => void'
//strictBindCallApply-
//strictPropertyInitialization-
//noImplicitThis-
"strict": true,

"isolatedModules": true
}
}
2 changes: 1 addition & 1 deletion packages/provider-mongo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
},
"devDependencies": {
"contexture": "^0.12.23",
"mongodb-memory-server": "^9.1.1"
"mongodb-memory-server": "^10.1.4"
}
}
49 changes: 49 additions & 0 deletions packages/provider-mongo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
//Inherits settings from ../tsconfig.all.jsonc which is at root level
"extends": ["../../tsconfig.all.jsonc"],

//Tells TypeScript to only compile files inside the src/ folder and its subdirectories.
//It includes .ts, .tsx, .js, and .jsx
"include": ["src/**/*"],

//compilerOptions inherited from tsconfig.all.jsonc are overridden here.
// i have taken reference from spark/web compilerOptions.In that also we are overridding
"compilerOptions": {
//Provides Node.js global types and includes types for Vitest which is used by test files
"types": ["node", "vitest"],

"outDir": "dist", // Output directory for compiled files

//same as what we do in Spark , a node_modules folder at root level , with in a subfolder named 'provider-mongo'
"tsBuildInfoFile": "../../node_modules/.buildinfo/provider-mongo",

//Allows TypeScript to compile JavaScript files
"allowJs": true,

//Disables type checking on .js files.
"checkJs": false,

//Ensures that functions always return a value.for example there is whole code of function wrapped under IF statment,
//then it will throw Error: Not all code paths return a value.
"noImplicitReturns": true,

//Forces explicit undefined checks when accessing arrays or objects.
//for example let x = arr[0]; // Error: x might be undefined.
//to fix this let x: number[] | undefined or let x = arr[0] as number;
"noUncheckedIndexedAccess": true,

//Ensures function parameters are used.// Error: 'name' is unused.
"noUnusedParameters": true,

//strict it self holds 6 different type of checks
//strictNullChecks-Error: Type 'null' is not assignable to 'string'
//noImplicitAny-Error: Parameter 'name' implicitly has an 'any' type
//strictFunctionTypes-Error: Type '(age: number) => void' is not assignable to type '(name: string) => void'
//strictBindCallApply-
//strictPropertyInitialization-
//noImplicitThis-
"strict": true,

"isolatedModules": true
}
}
49 changes: 49 additions & 0 deletions packages/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
//Inherits settings from ../tsconfig.all.jsonc which is at root level
"extends": ["../../tsconfig.all.jsonc"],

//Tells TypeScript to only compile files inside the src/ folder and its subdirectories.
//It includes .ts, .tsx, .js, and .jsx
"include": ["src/**/*"],

//compilerOptions inherited from tsconfig.all.jsonc are overridden here.
// i have taken reference from spark/web compilerOptions.In that also we are overridding
"compilerOptions": {
//Provides Node.js global types and includes types for Vitest which is used by test files
"types": ["node", "vitest"],

"outDir": "dist", // Output directory for compiled files

//same as what we do in Spark , a node_modules folder at root level , with in a subfolder named 'server'
"tsBuildInfoFile": "../../node_modules/.buildinfo/server",

//Allows TypeScript to compile JavaScript files
"allowJs": true,

//Disables type checking on .js files.
"checkJs": false,

//Ensures that functions always return a value.for example there is whole code of function wrapped under IF statment,
//then it will throw Error: Not all code paths return a value.
"noImplicitReturns": true,

//Forces explicit undefined checks when accessing arrays or objects.
//for example let x = arr[0]; // Error: x might be undefined.
//to fix this let x: number[] | undefined or let x = arr[0] as number;
"noUncheckedIndexedAccess": true,

//Ensures function parameters are used.// Error: 'name' is unused.
"noUnusedParameters": true,

//strict it self holds 6 different type of checks
//strictNullChecks-Error: Type 'null' is not assignable to 'string'
//noImplicitAny-Error: Parameter 'name' implicitly has an 'any' type
//strictFunctionTypes-Error: Type '(age: number) => void' is not assignable to type '(name: string) => void'
//strictBindCallApply-
//strictPropertyInitialization-
//noImplicitThis-
"strict": true,

"isolatedModules": true
}
}
49 changes: 49 additions & 0 deletions packages/util/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
//Inherits settings from ../tsconfig.all.jsonc which is at root level
"extends": ["../../tsconfig.all.jsonc"],

//Tells TypeScript to only compile files inside the src/ folder and its subdirectories.
//It includes .ts, .tsx, .js, and .jsx
"include": ["src/**/*"],

//compilerOptions inherited from tsconfig.all.jsonc are overridden here.
// i have taken reference from spark/web compilerOptions.In that also we are overridding
"compilerOptions": {
//Provides Node.js global types and includes types for Vitest which is used by test files
"types": ["node", "vitest"],

"outDir": "dist", // Output directory for compiled files

//same as what we do in Spark , a node_modules folder at root level , with in a subfolder named 'util'
"tsBuildInfoFile": "../../node_modules/.buildinfo/util",

//Allows TypeScript to compile JavaScript files
"allowJs": true,

//Disables type checking on .js files.
"checkJs": false,

//Ensures that functions always return a value.for example there is whole code of function wrapped under IF statment,
//then it will throw Error: Not all code paths return a value.
"noImplicitReturns": true,

//Forces explicit undefined checks when accessing arrays or objects.
//for example let x = arr[0]; // Error: x might be undefined.
//to fix this let x: number[] | undefined or let x = arr[0] as number;
"noUncheckedIndexedAccess": true,

//Ensures function parameters are used.// Error: 'name' is unused.
"noUnusedParameters": true,

//strict it self holds 6 different type of checks
//strictNullChecks-Error: Type 'null' is not assignable to 'string'
//noImplicitAny-Error: Parameter 'name' implicitly has an 'any' type
//strictFunctionTypes-Error: Type '(age: number) => void' is not assignable to type '(name: string) => void'
//strictBindCallApply-
//strictPropertyInitialization-
//noImplicitThis-
"strict": true,

"isolatedModules": true
}
}
19 changes: 19 additions & 0 deletions tsconfig.all.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"allowUnreachableCode": false, // Prevents accidental execution of unreachable code.
"allowUnusedLabels": false, // Disallows unused labels to avoid confusion in code.
"noFallthroughCasesInSwitch": true, // Ensures every switch case explicitly handles its execution flow.
"noUnusedLocals": true, // Reports unused local variables to keep the code clean.
"noErrorTruncation": true, // Prevents truncation of error messages for better debugging.
"isolatedModules": true, // Ensures each module can be transpiled independently for better tooling support.
"verbatimModuleSyntax": true, // Enforces explicit use of `type` imports for type-only dependencies.
"module": "nodenext", // Uses the ES module system compatible with Node.js.
"moduleResolution": "nodenext", // Resolves modules as per Node.js ESM standards.
"resolveJsonModule": true, // Allows importing JSON files as modules.
"types": ["vite/client", "vitest/globals"], // Restricts the global scope to these type definitions.
"jsx": "react", // Specifies JSX transformation method for React applications.
"noEmitOnError": true, // Prevents output generation if there are TypeScript errors.
"incremental": true, // Enables incremental builds for better performance.
"skipLibCheck": true // Skips type checking of library declaration files to speed up compilation.
}
}
14 changes: 14 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Good reference for project references in a monorepo setting
// https://moonrepo.dev/docs/guides/javascript/typescript-project-refs
{
// Do not doubly build files (they're already being built via references).
"files": [],
"references": [
{ "path": "./packages/client/tsconfig.json" },
{ "path": "./packages/export/tsconfig.json" },
{ "path": "./packages/provider-elasticsearch/tsconfig.json" },
{ "path": "./packages/provider-mongo/tsconfig.json" },
{ "path": "./packages/server/tsconfig.json" },
{ "path": "./packages/util/tsconfig.json" }
]
}
Loading