Skip to content

Commit

Permalink
Merge pull request #17 from Igorbek/feature/remove-ts-is-kind
Browse files Browse the repository at this point in the history
Remove `ts-is-kind` dependency and update TS peer dependency
  • Loading branch information
Igorbek authored Aug 30, 2018
2 parents 9adce11 + a207594 commit 3195e15
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 9 deletions.
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
"runner": "ts-node ./src/runner.ts"
},
"typings": "dist/index.d.ts",
"dependencies": {
"ts-is-kind": "^1.0.0"
},
"peerDependencies": {
"typescript": "^2.5.2"
"typescript": "^2.5.2 || ^3.0"
},
"devDependencies": {
"@types/jest": "^19.2.4",
Expand Down
2 changes: 1 addition & 1 deletion src/createTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
isVariableDeclaration,
isExportAssignment,
isTaggedTemplateExpression,
} from 'ts-is-kind';
} from './ts-is-kind';

import {Options} from './models/Options';

Expand Down
52 changes: 52 additions & 0 deletions src/ts-is-kind.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// The source code is kindly borrowed from `ts-is-kind` npm module.
// Original repo: https://github.com/mohsen1/ts-is-kind by @mohsen1

import * as ts from 'typescript';

/**
* Return true if node is `PropertyAccessExpression`
* @param node A TypeScript node
*/
export function isPropertyAccessExpression(node: ts.Node): node is ts.PropertyAccessExpression {
return node.kind === ts.SyntaxKind.PropertyAccessExpression;
}

/**
* Return true if node is `CallExpression`
* @param node A TypeScript node
*/
export function isCallExpression(node: ts.Node): node is ts.CallExpression {
return node.kind === ts.SyntaxKind.CallExpression;
}

/**
* Return true if node is `Identifier`
* @param node A TypeScript node
*/
export function isIdentifier(node: ts.Node): node is ts.Identifier {
return node.kind === ts.SyntaxKind.Identifier;
}

/**
* Return true if node is `VariableDeclaration`
* @param node A TypeScript node
*/
export function isVariableDeclaration(node: ts.Node): node is ts.VariableDeclaration {
return node.kind === ts.SyntaxKind.VariableDeclaration;
}

/**
* Return true if node is `ExportAssignment`
* @param node A TypeScript node
*/
export function isExportAssignment(node: ts.Node): node is ts.ExportAssignment {
return node.kind === ts.SyntaxKind.ExportAssignment;
}

/**
* Return true if node is `TaggedTemplateExpression`
* @param node A TypeScript node
*/
export function isTaggedTemplateExpression(node: ts.Node): node is ts.TaggedTemplateExpression {
return node.kind === ts.SyntaxKind.TaggedTemplateExpression;
}
4 changes: 0 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2209,10 +2209,6 @@ trim-right@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"

ts-is-kind@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/ts-is-kind/-/ts-is-kind-1.0.0.tgz#f9ca9c1af07ddb82d7a06744d8928952d4bd2426"

ts-jest@20:
version "20.0.6"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-20.0.6.tgz#39c2810c05d6f6908dac15929dae206b494b73f4"
Expand Down

0 comments on commit 3195e15

Please sign in to comment.