Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to resolve "tslib" from <path>

I have a TS with JS based React Native application. During moving some old JS stuff to TS I'm receiving an error:

Unable to resolve "tslib" from

What can it mean and how can I fix it? The file looks like this:

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)
            });
    }
}
like image 482
Vladyslav Zavalykhatko Avatar asked Oct 27 '25 00:10

Vladyslav Zavalykhatko


1 Answers

Fixed with installing tslib:

npm install --save tslib

like image 189
Vladyslav Zavalykhatko Avatar answered Oct 29 '25 17:10

Vladyslav Zavalykhatko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!