{"id":20592152,"url":"https://github.com/igelbox/lectures","last_synced_at":"2025-08-22T14:09:01.953Z","repository":{"id":72894809,"uuid":"104608342","full_name":"igelbox/lectures","owner":"igelbox","description":"Some examples for my lectures","archived":false,"fork":false,"pushed_at":"2017-10-02T08:43:07.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"ts-js","last_synced_at":"2025-03-06T13:47:25.858Z","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/igelbox.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":"2017-09-24T00:42:57.000Z","updated_at":"2017-09-24T05:27:46.000Z","dependencies_parsed_at":"2023-09-18T12:15:57.234Z","dependency_job_id":null,"html_url":"https://github.com/igelbox/lectures","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/igelbox/lectures","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igelbox%2Flectures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igelbox%2Flectures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igelbox%2Flectures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igelbox%2Flectures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igelbox","download_url":"https://codeload.github.com/igelbox/lectures/tar.gz/refs/heads/ts-js","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igelbox%2Flectures/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271650860,"owners_count":24796725,"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-08-22T02:00:08.480Z","response_time":65,"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-11-16T07:42:52.152Z","updated_at":"2025-08-22T14:09:01.894Z","avatar_url":"https://github.com/igelbox.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Advanced examples for a lecture about integration TypeScript into a JavaScript-based project.\n\nThere are two complex examples which require a special/custom version of TypeScript compiler:\n1. The `dynamic_cast` example:\n```ts\ntype Struct = {\n  a: number,\n  b: string[],\n  c: 'abc' | 'def',\n}\n\nconst value: any = {\n  a: 123,\n  b: [],\n  c: 'qwe',\n};\n\nconst cast = dynamic_cast\u003cStruct\u003e(value); // Will fail with 'should be equal to one of the allowed values' error\n```\n\n2. The `Spring-like REST controller` example:\n```ts\n@RestController({ path: '/api/v1' })\nclass TestController {\n  @RequestMapping({ path: '/{pathVariable}', method: 'POST' })\n  request(\n    @RequestBody() body: {\n      a: number;\n      b: string;\n      c: number[];\n    },\n    @PathVariable({}) pathVariable: number,\n    @RequestParam() flag: boolean,\n  ) {\n    return {\n      body,\n      path: pathVariable,\n      flag,\n    };\n  }\n}\n```\nSo, the following request will fail due to all three parameters (path variable, query parameter, and request body) have incompatible types.\n```js\nPOST /api/v1/qwe?flag=rty\n{\n  a: 1,\n  b: 'two',\n  c: [1, '2']\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figelbox%2Flectures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figelbox%2Flectures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figelbox%2Flectures/lists"}