Skip to content
Permalink
Browse files

fix: Updated TypeScript to version 3

  • Loading branch information...
roman.vasilev
roman.vasilev committed Feb 12, 2019
1 parent 0b8f307 commit 155cdbc208f7e89b2d7f51af03d37a7ed51102c0
Showing with 25 additions and 13 deletions.
  1. +2 −4 package.json
  2. +19 −8 src/module.ts
  3. +4 −1 src/parse.spec.ts
@@ -26,14 +26,13 @@
"build": "sh Taskfile build",
"prebuild": "npm run clean",
"clean": "rimraf dist",
"commit": "git-cz",
"benchmark": "node -r ts-node/register/transpile-only node_modules/benchmarko/lib/bin.js -f benchmarks/parse-module-node"
"commit": "git-cz"
},
"dependencies": {
"object-values": "^2.0.0",
"resolve": "^1.10.0",
"tslib": "^1.9.3",
"typescript": "^2.9.2"
"typescript": "^3.3.3"
},
"devDependencies": {
"@semantic-release/changelog": "^3.0.2",
@@ -45,7 +44,6 @@
"@types/resolve": "0.0.8",
"@typescript-eslint/eslint-plugin-tslint": "^1.3.0",
"@typescript-eslint/parser": "^1.3.0",
"benchmarko": "0.0.2",
"eslint": "^5.13.0",
"eslint-import-resolver-node": "^0.3.2",
"eslint-plugin-import": "^2.16.0",
@@ -107,14 +107,25 @@ export function module(id: string, options: ModuleOptions = {}): Promise<Entry[]
done([]);
}
items.forEach(item => {
stat(resolvePath(dirpath, item, 'package.json'), (err, stats) => {
if (stats && stats.isFile()) {
submodules.push(`${id}/${item}`);
}
if (--count === 0) {
done(submodules);
}
});
// TODO: Fix me, remove isTypes
if (isTypes && item.slice(-5) === '.d.ts') {
const itemFile = resolvePath(dirpath, item);
return file(itemFile, options).then(items => {
entries.push(...items);
if (--count === 0) {
done(submodules);
}
});
} else {
stat(resolvePath(dirpath, item, 'package.json'), (err, stats) => {
if (stats && stats.isFile()) {
submodules.push(`${id}/${item}`);
}
if (--count === 0) {
done(submodules);
}
});
}
});
});
}).then(submodules => {
@@ -186,7 +186,7 @@ declare module "preact" {
assert(result[1].name === 'AnyComponent');
});

it.skip('react definitions', () => {
it('react definitions', () => {
const source = `
export = React;
export as namespace React;
@@ -198,6 +198,9 @@ declare namespace React {
`;
const result = parse(source);
assert(result.length > 0);
assert(result.find(e => e.name === 'ReactType'));
assert(result.find(e => e.name === 'Component'));
assert(result.find(e => e.name === 'PureComponent'));
});

it('webpack', () => {

0 comments on commit 155cdbc

Please sign in to comment.
You can’t perform that action at this time.