From 491b0caf1823d638dc203b00a3dfafb3ab6eec44 Mon Sep 17 00:00:00 2001 From: Steven Cramer Date: Sun, 1 Apr 2018 07:50:39 +0000 Subject: [PATCH 1/4] sort dependencies Lets keep these sorted so easier to find and see differences. --- devDependencies.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/devDependencies.json b/devDependencies.json index ca4c494..265f584 100644 --- a/devDependencies.json +++ b/devDependencies.json @@ -1,9 +1,9 @@ [ - "typescript", - "react-native-typescript-transformer", - "ts-jest", + "@types/jest", "@types/react", "@types/react-native", - "@types/jest", - "@types/react-test-renderer" + "@types/react-test-renderer", + "react-native-typescript-transformer", + "ts-jest", + "typescript" ] From 7b686518ed292eaa0335c217f6bc52c97715dfe0 Mon Sep 17 00:00:00 2001 From: Steven Cramer Date: Sun, 1 Apr 2018 07:52:22 +0000 Subject: [PATCH 2/4] Allow esModuleInterop Allow default imports from modules with no default export. This does not affect code emit, just typechecking. Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. --- tsconfig.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index a0073d5..f9169cb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,9 @@ "jsx": "react", "noEmit": true, "moduleResolution": "node", - "noImplicitAny": true + "noImplicitAny": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true }, "exclude": [ "node_modules" From 590b9f83263675f0223093404f2d80ddd1c53a4c Mon Sep 17 00:00:00 2001 From: Steven Cramer Date: Sun, 1 Apr 2018 07:53:51 +0000 Subject: [PATCH 3/4] Update to Standard React Native Template import react-native default template uses import React from 'react' and this is now supported the the allowSyntheticDefaultImports enabled. --- App.tsx | 2 +- __tests__/App.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/App.tsx b/App.tsx index f0cc835..69b1f0c 100644 --- a/App.tsx +++ b/App.tsx @@ -6,7 +6,7 @@ * https://github.com/emin93/react-native-template-typescript */ -import * as React from 'react'; +import React from 'react'; import { Platform, StyleSheet, diff --git a/__tests__/App.tsx b/__tests__/App.tsx index 10f485d..8453763 100644 --- a/__tests__/App.tsx +++ b/__tests__/App.tsx @@ -1,5 +1,5 @@ import 'react-native'; -import * as React from 'react'; +import React from 'react'; import App from '../App'; // Note: test renderer must be required after react-native. From 126df709d6941c3009903782f107ee28a705ceb7 Mon Sep 17 00:00:00 2001 From: Steven Cramer Date: Sun, 1 Apr 2018 09:15:57 +0000 Subject: [PATCH 4/4] Update import in test Update the import in __tests__\App.tsx to align with react-native --- __tests__/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/App.tsx b/__tests__/App.tsx index 8453763..d0b9ee3 100644 --- a/__tests__/App.tsx +++ b/__tests__/App.tsx @@ -3,7 +3,7 @@ import React from 'react'; import App from '../App'; // Note: test renderer must be required after react-native. -import * as renderer from 'react-test-renderer'; +import renderer from 'react-test-renderer'; it('renders correctly', () => { const tree = renderer.create(