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

fix error "Cannot read property 'find' of undefined" with typescript files #101

Merged
merged 3 commits into from
Jun 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;");
});
});
});