{"id":15594205,"url":"https://github.com/orta/react-native-45-typescript-example","last_synced_at":"2025-05-06T22:59:28.365Z","repository":{"id":66647275,"uuid":"93994652","full_name":"orta/react-native-45-typescript-example","owner":"orta","description":"An example of taking react-native's default template and making it work with typescript","archived":false,"fork":false,"pushed_at":"2017-06-11T09:54:15.000Z","size":132,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T22:59:14.248Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/orta.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}},"created_at":"2017-06-11T09:31:20.000Z","updated_at":"2019-10-24T17:14:35.000Z","dependencies_parsed_at":"2023-04-24T16:48:01.739Z","dependency_job_id":null,"html_url":"https://github.com/orta/react-native-45-typescript-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orta%2Freact-native-45-typescript-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orta%2Freact-native-45-typescript-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orta%2Freact-native-45-typescript-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orta%2Freact-native-45-typescript-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orta","download_url":"https://codeload.github.com/orta/react-native-45-typescript-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782482,"owners_count":21803383,"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":[],"created_at":"2024-10-03T00:34:52.063Z","updated_at":"2025-05-06T22:59:28.344Z","avatar_url":"https://github.com/orta.png","language":"JavaScript","funding_links":[],"categories":["Index"],"sub_categories":["Typescript"],"readme":"This is the minimal possible setup to get a _in memory_ version of React Native working with TypeScript support. The current techniques use a multi-step process, you save -\u003e TypeScript creates JS file -\u003e Babel sees JS file and compiles to ES5. This replaces that with a custom transformer that will either pass the file to Babel or the TypeScript compiler.\n\nIf you want to see a non-trivial production version: https://github.com/artsy/emission\n\nThis repo is the techniques inside that app replicated against a new project.\n\n---\n\nSteps required to make this project:\n\n* `npm install -g react-native-cli`\n* `react-native init MyProject`\n* `cd MyProject`\n* `yarn add typescript --dev`\n* `yarn tsc -- --init`\n* change tsconfig.json:\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"es5\",  \n    \"module\": \"commonjs\",\n    \"jsx\": \"react\", \n    \"strict\": true  \n  }\n}\n```\n\n* create - rn-cli.config.js\n\n```js\nmodule.exports = {\n  getSourceExts() {\n    return [\"js\", \"ts\", \"tsx\"]\n  },\n\n  getTransformModulePath() {\n    return require.resolve(\"./transformer\")\n  },\n}\n```\n\n* create transformer folder, and copy emission files in there (https://github.com/artsy/emission/tree/master/transformer)\n* You _have_ to keep `index.ios.js` `index.android.js` to use those to load a TSX component, in this case `home.tsx`\n* `react-native run-ios` to start it up\n\n\n---\n\nMaking it feel good:\n\n* `yarn add @types/react-native --dev`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forta%2Freact-native-45-typescript-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forta%2Freact-native-45-typescript-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forta%2Freact-native-45-typescript-example/lists"}