Skip to content
This repository was archived by the owner on Dec 4, 2022. It is now read-only.

Commit 2d7c990

Browse files
authored
fix teambit/bit#1690, fix error Cannot read property "find" of undefined when a typescript file has an import statement without a specifier (#101)
1 parent 3da32ff commit 2d7c990

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [unreleased]
99

10+
## [2.0.10] - 2019-05-31
11+
12+
- [#1690](https://github.com/teambit/bit/issues/1690) fix error "Cannot read property 'find' of undefined" with typescript files
13+
1014
## [2.0.9] - 2019-05-31
1115

1216
- [#1665](https://github.com/teambit/bit/issues/1665) fix resolve-modules prefix with tilda

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bit-javascript",
3-
"version": "2.0.9",
3+
"version": "2.0.10",
44
"scripts": {
55
"flow": "flow; test $? -eq 0 -o $? -eq 2",
66
"lint": "eslint src && flow check || true",

src/dependency-builder/detectives/detective-typescript/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module.exports = function (src, options = {}) {
3232
};
3333
const addExportedToImportSpecifier = (name) => {
3434
Object.keys(dependencies).forEach((dependency) => {
35+
if (!dependencies[dependency].importSpecifiers) return;
3536
const specifier = dependencies[dependency].importSpecifiers.find(i => i.name === name);
3637
if (specifier) specifier.exported = true;
3738
});

src/dependency-builder/detectives/detective-typescript/index.spec.js

+6
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,10 @@ describe('detective-typescript', () => {
113113
detective("import foo from 'foo'; var baz = <baz>bar;");
114114
});
115115
});
116+
117+
it('does not throw with empty import and export', () => {
118+
assert.doesNotThrow(() => {
119+
detective("import './layout.scss'; export default something;");
120+
});
121+
});
116122
});

0 commit comments

Comments
 (0)