-
Notifications
You must be signed in to change notification settings - Fork 68
Conversation
TypeScript will complain about: "Type 'Node' is not assignable to type 'SourceFile'."
ts.NodeArray now is ReadonlyArray, helper functions should accept ArrayLike arguments.
@@ -39,12 +39,12 @@ export const allTransforms = [ | |||
reactRemoveStaticPropTypesMemberTransformFactoryFactory, | |||
]; | |||
|
|||
export type TransformFactoryFactory = (typeChecker: ts.TypeChecker) => ts.TransformerFactory<ts.Node>; | |||
export type TransformFactoryFactory = (typeChecker: ts.TypeChecker) => ts.TransformerFactory<ts.SourceFile>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -150,10 +121,12 @@ export function insertAfter<T>(collection: T[], afterItem: T, newItem: T) { | |||
* @param beforeItem | |||
* @param newItem | |||
*/ | |||
export function insertBefore<T>(collection: T[], beforeItem: T, newItem: T) { | |||
const index = collection.indexOf(beforeItem); | |||
export function insertBefore<T>(collection: ArrayLike<T>, beforeItem: T, newItems: T | T[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/helpers/index.ts
Outdated
|
||
// export const has = some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this
src/helpers/index.ts
Outdated
|
||
return false; | ||
} | ||
export { find }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use find imported from loads where it is needed
src/helpers/index.ts
Outdated
import * as kinds from './isKind'; | ||
|
||
export * from './isKind'; | ||
import { find, indexOf, slice } from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're using namespace imports in this project
import * as _ from 'lodash'
) { | ||
const allMembers = node.type.types | ||
.map((type: ts.TypeLiteralNode) => type.members) | ||
const allMembers = (node.type.types as ts.NodeArray<ts.TypeLiteralNode>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we have to cast to ts.NodeArray<ts.TypeLiteralNode>
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I think casting should be fine for now. I'll dig deeper into it soon.
A few notes, otherwise looks good! Thanks! |
I split this into multiple commits for easier reviewing. You can view commits one by one.