dsherret / ts-morph

TypeScript Compiler API wrapper for static analysis and programmatic code changes.

Home Page:https://ts-morph.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fixMissingImports() not importing missing ObjectId from bson

mownikaasokan opened this issue · comments

Describe the bug
Using ts-morph in fixing missing imports when converting flow file to Typescript file. It doesn't fix missing import for ObjectId. (which is from bson package)

Version: 13.0.2

To Reproduce

Input TS file. Both the types are used in the file.

// @flow
/* flow-include
 import type { LineItemLayout } from './types/line-item-layout'
 import type { ObjectId } from 'bson'
*/
...

Actual behavior
Only one import is added.

// @flow
/* flow-include
 import type { LineItemLayout } from './types/line-item-layout'
 import type { ObjectId } from 'bson'
*/

import { LineItemLayout } from './types/line-item-layout'
...

Expected behavior
Both the imports are added.

// @flow
/* flow-include
 import type { LineItemLayout } from './types/line-item-layout'
 import type { ObjectId } from 'bson'
*/

import { LineItemLayout } from './types/line-item-layout'
import { ObjectId } from 'bson'
...