{"id":29071384,"url":"https://github.com/selectel/ts-check","last_synced_at":"2025-06-27T13:30:32.549Z","repository":{"id":275638418,"uuid":"926542997","full_name":"selectel/ts-check","owner":"selectel","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-03T18:28:48.000Z","size":36,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-30T23:11:00.015Z","etag":null,"topics":["typescript","typescript-library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selectel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-03T12:52:03.000Z","updated_at":"2025-05-23T09:54:28.000Z","dependencies_parsed_at":"2025-02-03T19:35:14.105Z","dependency_job_id":"339dfdde-655f-403e-a45b-6be7fb054128","html_url":"https://github.com/selectel/ts-check","commit_stats":null,"previous_names":["selectel/ts-check"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/selectel/ts-check","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Fts-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Fts-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Fts-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Fts-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selectel","download_url":"https://codeload.github.com/selectel/ts-check/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Fts-check/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262264853,"owners_count":23284400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["typescript","typescript-library"],"created_at":"2025-06-27T13:30:26.797Z","updated_at":"2025-06-27T13:30:32.532Z","avatar_url":"https://github.com/selectel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CLI utility for checking types using TypeScript server\n\nType checking is performed using the TypeScript server [project system](https://github.com/microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29#project-system).\n\n## Requirements\n\nThis package requires at least typescript 5.\n\n## Install\n\nInstall `typescript` and `@selectel/ts-check` using your package manager.\n\n```bash\nnpm install --save-dev typescript @selectel/ts-check\n```\n\n## Usage\n\n```bash\nnpx ts-check [\u003cfiles...\u003e]\n```\n\nThe arguments are a list of files to check. Other options:\n\n```\nts-check [options] [\u003cfiles...\u003e]\n\nChecking types for the passed list of files\n\nOptions:\n      --no-color           Disable colors for output                  [boolean]\n  -b, --code-lines-before  Print \u003cnumber\u003e lines of code before error  [number]\n  -a, --code-lines-after   Print \u003cnumber\u003e lines of code after error   [number]\n      --gitlab-report      Path to gitlab code quality report file    [string]\n  -v, --verbose            Run with verbose logging                   [boolean]\n  -h, --help               Show a help message                        [boolean]\n      --files              A list of files for type checking          [Array\u003cstring\u003e]\n```\n\n## GitLab code quality\n\nDefine a GitLab job to run `ts-check`.\n\n_.gitlab-ci.yml_:\n\n```yaml\nts-check:\n  image: node:20-alpine\n  script:\n    - npm ci\n    - npx ts-check --gitlab-report ts-check-report.json \u003cpaths/to/files/*.ts\u003e\n  artifacts:\n    reports:\n      codequality: ts-check-report.json\n```\n\n## TypeScript server\n\nThe package also provides an simple interface for communicating with the TypeScript server.\n\n```ts\nimport ts from \"typescript\";\nimport { TsServer } from \"@selectel/ts-check\";\n\nconst file = \"test.ts\";\n\n// Request to open file\nconst openRequest: ts.server.protocol.OpenRequest = {\n  seq: 1,\n  type: \"request\",\n  command: ts.server.protocol.CommandTypes.Open,\n  arguments: { file },\n};\n\n// Request to search for errors in a file\nconst diagnosticRequest: ts.server.protocol.SemanticDiagnosticsSyncRequest = {\n  seq: 2,\n  type: \"request\",\n  command: ts.server.protocol.CommandTypes.SemanticDiagnosticsSync,\n  arguments: { file },\n};\n\n// Create a server instance\nconst server = new TsServer();\n\n// RxJs observable with server responses\nconst responses$ = server.listen();\n\n// Subscribe to server responses\nresponses$.subscribe(console.log);\n\n// Sending requests to the server\nserver.send(openRequest);\nserver.send(diagnosticRequest);\n```\n\n## Other\n\n* [Documentation of TypeScript server](https://github.com/microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29)\n* [Example usage of TypeScript server](https://github.com/mmorearty/tsserver-example)\n* [GitLab Code Quality documentation](https://docs.gitlab.com/ee/ci/testing/code_quality.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselectel%2Fts-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselectel%2Fts-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselectel%2Fts-check/lists"}