首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法从<path>解析"tslib“

无法从<path>解析"tslib“
EN

Stack Overflow用户
提问于 2018-06-09 10:44:26
回答 1查看 1.6K关注 0票数 1

我有一个基于JS的React本地应用程序的TS。在将一些旧的JS东西移到TS时,我收到了一个错误:

无法从

它能意味着什么,我如何修复它?该文件如下所示:

代码语言:javascript
复制
import WordsService from './../data/wordsService/WordsService'
import { Word } from './../types/Word'
import { Dispatch, GetState, Action } from './../types/Redux'

export const dictionaryAction = {
    ADD_NEW_WORD: "dictionaryActions.ADD_NEW_WORD",
    DELETE_WORD: "dictionaryActions.DELETE_WORD",
    SET_WORDS: "dictionaryActions.SET_WORDS"
}

export const setWords = (words: Word[]): Action => {
    return { type: dictionaryAction.SET_WORDS, payload: words }
}

export const addNewWord = (word: Word) => {
    return (dispatch: Dispatch, getState: GetState) => {
        new WordsService().addNewWord(word)
            .then((insertedWord) => {
                const insertId = insertedWord.insertId
                word.id = insertId
                dispatch({ type: dictionaryAction.ADD_NEW_WORD, payload: word })
            })
            .catch(error => {
                console.log(error)
            });
    }
}

export const deleteWord = (word: Word) => {
    return (dispatch: Dispatch, getState: GetState) => {
        new WordsService().deleteWord(word)
            .then(() => {
                dispatch({ type: dictionaryAction.DELETE_WORD, payload: word })
            })
            .catch(error => {
                console.log(error)
            });
    }
}

export const getLocalWords = () => {
    return (dispatch: Dispatch, getState: GetState) => {
        new WordsService().getLocalWords()
            .then(words => {
                dispatch(setWords(words))
            })
            .catch(error => {
                console.log(error)
            });
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-09 10:51:55

修正了安装tslib

npm install --save tslib

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50773412

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档