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

Commit

Permalink
fix teambit/bit#1690, fix error Cannot read property "find" of undefi…
Browse files Browse the repository at this point in the history
…ned when a typescript file has an import statement without a specifier (#101)
  • Loading branch information
davidfirst authored Jun 1, 2019
1 parent 3da32ff commit 2d7c990
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]

## [2.0.10] - 2019-05-31

- [#1690](https://github.com/teambit/bit/issues/1690) fix error "Cannot read property 'find' of undefined" with typescript files

## [2.0.9] - 2019-05-31

- [#1665](https://github.com/teambit/bit/issues/1665) fix resolve-modules prefix with tilda
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bit-javascript",
"version": "2.0.9",
"version": "2.0.10",
"scripts": {
"flow": "flow; test $? -eq 0 -o $? -eq 2",
"lint": "eslint src && flow check || true",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module.exports = function (src, options = {}) {
};
const addExportedToImportSpecifier = (name) => {
Object.keys(dependencies).forEach((dependency) => {
if (!dependencies[dependency].importSpecifiers) return;
const specifier = dependencies[dependency].importSpecifiers.find(i => i.name === name);
if (specifier) specifier.exported = true;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,10 @@ describe('detective-typescript', () => {
detective("import foo from 'foo'; var baz = <baz>bar;");
});
});

it('does not throw with empty import and export', () => {
assert.doesNotThrow(() => {
detective("import './layout.scss'; export default something;");
});
});
});

0 comments on commit 2d7c990

Please sign in to comment.