piotrwitek / react-redux-typescript-guide

The complete guide to static typing in "React & Redux" apps using TypeScript
https://piotrwitek.github.io/react-redux-typescript-guide/
MIT License
13.35k stars 1.09k forks source link

Playground fails to compile - import order #197

Closed chmac closed 4 years ago

chmac commented 4 years ago

Description

When starting the playground app the following error is generated:

Failed to compile.

./src/features/counters/actions.ts
  Line 18:1:  Import in body of module; reorder to top  import/first
  Line 19:1:  Import in body of module; reorder to top  import/first

Search for the keywords to learn more about each error.

Steps to Reproduce

  1. npm i then npm start in the playground/ directory

Expected behavior

App starts

Suggested solution(s)

Change the import order

diff --git a/playground/src/features/counters/actions.ts b/playground/src/features/counters/actions.ts
index 5833707..05c6fb4 100644
--- a/playground/src/features/counters/actions.ts
+++ b/playground/src/features/counters/actions.ts
@@ -2,6 +2,9 @@ import { action } from 'typesafe-actions';

 import { ADD, INCREMENT } from './constants';

+import { createAction } from 'typesafe-actions';
+import { Todo } from '../todos/models';
+
 /* SIMPLE API */

 export const increment = () => action(INCREMENT);
@@ -15,9 +18,6 @@ export const add = (amount: number) => action(ADD, amount);
 // This will allow to completely eliminate need for "constants" in your application, more info here:
 // https://github.com/piotrwitek/typesafe-actions#constants

-import { createAction } from 'typesafe-actions';
-import { Todo } from '../todos/models';
-
 export const emptyAction = createAction(INCREMENT)<void>();
 export const payloadAction = createAction(ADD)<number>();
 export const payloadMetaAction = createAction(ADD)<number, string>();
(END)
piotrwitek commented 4 years ago

Thanks for report @chmac