Reactjs TypeScript:TsLib不';t包含导入tar(\u导入tar不是函数)

Reactjs TypeScript:TsLib不';t包含导入tar(\u导入tar不是函数),reactjs,typescript,Reactjs,Typescript,我在一个TypeScript react项目上遇到了真正的麻烦,这个项目一直工作得很好,然后在一天工作到一半的时候 我得到TypeError:tslib_1.\u导入特定依赖项时,importStar不是一个函数 我已经进入依赖关系,它已经: var tslib_1 = require("tslib"); var url = tslib_1.__importStar(require("url")); 在dependency项目中,我可以转到tslib,它具有以下功能: export decla

我在一个TypeScript react项目上遇到了真正的麻烦,这个项目一直工作得很好,然后在一天工作到一半的时候

我得到
TypeError:tslib_1.\u导入特定依赖项时,importStar不是一个函数

我已经进入依赖关系,它已经:

var tslib_1 = require("tslib");
var url = tslib_1.__importStar(require("url"));
在dependency项目中,我可以转到tslib,它具有以下功能:

export declare function __extends(d: Function, b: Function): void;
export declare function __assign(t: any, ...sources: any[]): any;
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
export declare function __param(paramIndex: number, decorator: Function): Function;
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
export declare function __generator(thisArg: any, body: Function): any;
export declare function __exportStar(m: any, exports: any): void;
export declare function __values(o: any): any;
export declare function __read(o: any, n?: number): any[];
export declare function __spread(...args: any[]): any[];
export declare function __await(v: any): any;
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
export declare function __asyncDelegator(o: any): any;
export declare function __asyncValues(o: any): any;
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
export declare function __importStar<T>(mod: T): T;
export declare function __importDefault<T>(mod: T): T | { default: T };
importStar
确实缺失。但是为什么呢?我尝试了各种编译器选项:

{
  "compilerOptions": {
    "baseUrl": ".",
    "module": "commonjs",
    "target": "es5",
    "lib": ["es6", "dom"],
    "sourceMap": true,
    "allowJs": false,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDirs": ["src", "__component_tests__"],
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": false,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "importHelpers": true,
    "allowSyntheticDefaultImports": true
  }
}
(但不确定编译器选项如何更新节点_模块tslib依赖项


将分支恢复到以前的提交,并且已修复-即使查看差异,我也看不到可能导致此类症状的任何更改…

对于像我这样通过Google找到此问题的其他人,请注意,
\uuuuuuImportStar
\uuuuImportDefault
都在tslib的发行版中,如果您的代码找不到,请检查您的版本哼哼(
npm list | grep tslib
)。你找到解决方案了吗?@MridangAgarwalla我不记得了!我想手动安装更高版本的tslib解决了问题。
{
  "compilerOptions": {
    "baseUrl": ".",
    "module": "commonjs",
    "target": "es5",
    "lib": ["es6", "dom"],
    "sourceMap": true,
    "allowJs": false,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDirs": ["src", "__component_tests__"],
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": false,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "importHelpers": true,
    "allowSyntheticDefaultImports": true
  }
}