{"id":22175029,"url":"https://github.com/morningspace/lab-typescript","last_synced_at":"2025-07-25T02:39:22.120Z","repository":{"id":65445735,"uuid":"144223635","full_name":"morningspace/lab-typescript","owner":"morningspace","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-02T10:52:25.000Z","size":1842,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T18:18:54.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morningspace.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-08-10T01:55:52.000Z","updated_at":"2018-10-21T10:26:32.000Z","dependencies_parsed_at":"2024-12-02T18:16:49.963Z","dependency_job_id":null,"html_url":"https://github.com/morningspace/lab-typescript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/morningspace/lab-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morningspace%2Flab-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morningspace%2Flab-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morningspace%2Flab-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morningspace%2Flab-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morningspace","download_url":"https://codeload.github.com/morningspace/lab-typescript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morningspace%2Flab-typescript/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266945086,"owners_count":24010492,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-12-02T07:55:50.740Z","updated_at":"2025-07-25T02:39:22.097Z","avatar_url":"https://github.com/morningspace.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## MorningSpace Lab \n\n[晴耕实验室](https://morningspace.github.io/lab)\n\n[![晴耕小筑](https://morningspace.github.io/assets/images/banner.jpg)](https://morningspace.github.io/lab)\n\n# The Path to TypeScript\n\nKeywords: TypeScript\n\n## Overview\n\nThis is the lab project to demonstrate how to migrate a JavaScript project into TypeScript project step by step.\n\nThe project `TaskMe` is a very simple task management API service built by [LoopBack](http://loopback.io/). It was originally written in JavaScript. To \"tsify\" it, there are a few branches from `tsify-original` to `tsify-misc`, where each branch represents a certain stage on the migration path. By hitting the GitHub [Compare changes](https://github.com/morningspace/lab-typescript/compare) view, you can see the difference between each two branches.\n\nPlease check the below instructions to learn how to play with it.\n\nYou can also find the online slides [here](https://morningspace.github.io/lab-typescript), where it discussed:\n* Why TypeScript is so popular?\n* What is TypeScript? (by a few [demos](https://github.com/morningspace/lab-typescript/tree/master/code/demos))\n* How to tsify?\n\nAnd the [video series](http://list.youku.com/albumlist/show/id_51919965.html) recorded for the slides.\n\nFor more lab projects from MorningSpace Lab, please check [morningspace.github.io](https://morningspace.github.io).\n\n## Instructions\n\n### Branch: tsify-original\n\nThe very beginning stage. No TypeScript at all.\n\n### Branch: tsify-basic-use\n\nThis is the basic use of TypeScript. You can start to write TypeScript without changing any of your existing code. By adding type declaration files of project dependencies, you can enjoy auto-completion and code navigation when you call your dependencies. You can also get early benefits by trying to enable a few options in tsconfig.json, e.g. noImplicitReturns, noFallthroughCasesInSwitch, etc.\n\n### Branch: tsify-simple-trans\n\nStart to transform some JavaScript src files into TypeScript src files w/o big effort. Just simple rename and probably some tweaks in tsconfig.json to avoid tsc complains.\n\n### Branch: tsify-deep-trans\n\nTransform more JavaScript src files into TypeScript src files, add more TypeScript features incrementally, and use TypeScript more deeply. It normally requires some adjustments in the source code and tweaks in tsconfig.json.\n\n### Branch: tsify-misc\n\nComplete migration to TypeScript project, add tslint for lint check, nyc for code coverage, debug settings in vscode for TypeScript debugging, etc.\n\n## Troubleshooting\n\nSome typical errors can be seen as below when do the transformation.\n\n#### Error TS2339: Property 'abc' does not exist on type 'xyz'.\n\nThe simplest resolution to this issue is to define the type 'xyz' as _any_. Of course you can define _interface_ if it deserves. Keep in mind, whenever you use _any_, you lose out on most of the error checking and editor support that TypeScript gives you.\n\n#### Error TS2451: Cannot redeclare block-scoped variable 'xyz'\n\nThis is caused by the use of _let_ or _var_ when _require_ external module. Use ES6 syntax, the import statement instead.\n\n#### Error TS2693: 'Promise' only refers to a type, but is being used as a value here\n\nAdd \"es2015\" in \"lib\" settings in tsconfig.json.\n\n#### Error TS2307: Cannot find module 'your/path/to/something.json'\n\nSince TypeScript 2.9, JSON file import has been well supported by enabling resolveJsonModule in tsconfig.json. See: https://blogs.msdn.microsoft.com/typescript/2018/05/31/announcing-typescript-2-9/#json-imports\n\n#### Error TS6133: 'err' is declared but its value is never read.\n\nSee https://github.com/Microsoft/TypeScript/issues/9458.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorningspace%2Flab-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorningspace%2Flab-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorningspace%2Flab-typescript/lists"}