piotrwitek / typesafe-actions

Typesafe utilities for "action-creators" in Redux / Flux Architecture
https://codesandbox.io/s/github/piotrwitek/typesafe-actions/tree/master/codesandbox
MIT License
2.41k stars 99 forks source link

syntax error occurred while using "createAsyncAction" #227

Closed zi-gae closed 4 years ago

zi-gae commented 4 years ago

Description

did i make a mistake on my code?


Error

Syntax error: Unexpected token (48:18)

   46 |   LOAD_BLOCK_USERS_SUCCESS,
   47 |   LOAD_BLOCK_USERS_FAILURE,
> 48 | )<undefined, IData, AxiosError>();
                         ^

How to Reproduce

import axios, { AxiosError } from 'axios';

const LOAD_BLOCK_USERS = 'seoulgram/LOAD_BLOCK_USERS';
const LOAD_BLOCK_USERS_SUCCESS = 'seoulgram/LOAD_BLOCK_USERS_SUCCESS';
const LOAD_BLOCK_USERS_FAILURE = 'seoulgram/LOAD_BLOCK_USERS_FAILURE';

interface IData {
  total: number;
  items: Array<number>;
}
export const loadBlockUserRequestAsync = createAsyncAction(
  LOAD_BLOCK_USERS,
  LOAD_BLOCK_USERS_SUCCESS,
  LOAD_BLOCK_USERS_FAILURE,
)<undefined, IData, AxiosError>();

Project Dependencies


Environment (optional)

zi-gae commented 4 years ago

I solved this error

Solution

Install the latest version of the babel or using the TypeScript Loader

ts-loader | awesome-typescript-loader