Skip to content

Commit b96650f

Browse files
authored
feat: upgrading dependencies and add strict compile (#71)
1 parent dbef94d commit b96650f

File tree

15 files changed

+45
-35
lines changed

15 files changed

+45
-35
lines changed

.appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ matrix:
77

88
environment:
99
matrix:
10+
- nodejs_version: "10"
1011
- nodejs_version: "9"
1112
- nodejs_version: "8"
1213

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ notifications:
1414

1515
jobs:
1616
include:
17+
- stage: test
18+
node_js: '10'
19+
after_success:
20+
- npm i -g codecov
21+
- codecov
1722
- stage: test
1823
node_js: '9'
1924
after_success:
@@ -25,14 +30,14 @@ jobs:
2530
- npm i -g codecov
2631
- codecov
2732
- stage: deploy
28-
node_js: '9'
33+
node_js: '10'
2934
script: npm run typedoc
3035
deploy:
3136
provider: pages
3237
skip_cleanup: true
3338
github_token: $GH_TOKEN
3439
local_dir: ./docs
3540
- stage: deploy
36-
node_js: '9'
41+
node_js: '10'
3742
before_script: npm run build
3843
script: npm run semantic-release

config/tsconfig.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"declaration": true,
1010
"sourceMap": false,
1111
"importHelpers": true,
12-
"strictNullChecks": true,
12+
"strict": true,
1313
"experimentalDecorators": true,
1414
"emitDecoratorMetadata": true,
1515
"noUnusedLocals": true,

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,23 @@
3636
"homepage": "https://github.com/TypeScript-Heroes/node-typescript-parser#readme",
3737
"devDependencies": {
3838
"@smartive/tslint-config": "^3.0.1",
39-
"@types/jest": "^22.2.2",
39+
"@types/jest": "^23.1.2",
4040
"@types/lodash-es": "^4.17.0",
4141
"@types/mock-fs": "^3.6.30",
42-
"@types/node": "^9.6.2",
42+
"@types/node": "^10.3.6",
4343
"del-cli": "^1.1.0",
44-
"jest": "^22.4.3",
45-
"mock-fs": "^4.4.2",
46-
"semantic-release": "^15.1.5",
47-
"ts-jest": "^22.4.2",
48-
"tslint": "^5.9.1",
49-
"tsutils": "^2.26.0",
44+
"jest": "^23.2.0",
45+
"mock-fs": "^4.5.0",
46+
"semantic-release": "^15.6.0",
47+
"ts-jest": "^22.4.6",
48+
"tslint": "^5.10.0",
49+
"tsutils": "^2.27.1",
5050
"typedoc": "^0.11.1"
5151
},
5252
"dependencies": {
53-
"lodash": "^4.17.5",
54-
"lodash-es": "^4.17.8",
55-
"tslib": "^1.9.0",
56-
"typescript": "^2.8.1"
53+
"lodash": "^4.17.10",
54+
"lodash-es": "^4.17.10",
55+
"tslib": "^1.9.3",
56+
"typescript": "^2.9.2"
5757
}
5858
}

src/DeclarationIndex.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ export class DeclarationIndex {
490490
): void {
491491
exportedLib.declarations
492492
.forEach((o) => {
493+
if (!tsExport.specifiers) {
494+
return;
495+
}
493496
const ex = tsExport.specifiers.find(s => s.specifier === o.name);
494497
if (!ex) {
495498
return;

src/code-generators/TypescriptCodeGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type Generators = { [name: string]: (generatable: Generatable, options: T
3939
* Hash with all possible (yet implemented) generators.
4040
*/
4141
export const GENERATORS: Generators = {
42-
[SymbolSpecifier.name]: generateSymbolSpecifier,
42+
[SymbolSpecifier.name]: generateSymbolSpecifier as any,
4343
[MethodDeclaration.name]: generateMethodDeclaration,
4444
[ParameterDeclaration.name]: generateParameterDeclaration,
4545
[PropertyDeclaration.name]: generatePropertyDeclaration,

src/declarations/ClassDeclaration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { PropertyDeclaration } from './PropertyDeclaration';
1414
* @implements {GenericDeclaration}
1515
*/
1616
export class ClassDeclaration implements ClassLikeDeclaration, ExportableDeclaration, GenericDeclaration {
17-
public ctor: ConstructorDeclaration;
17+
public ctor: ConstructorDeclaration | undefined;
1818
public accessors: AccessorDeclaration[] = [];
1919
public properties: PropertyDeclaration[] = [];
2020
public methods: MethodDeclaration[] = [];

src/declarations/DefaultDeclaration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ import { Declaration, ExportableDeclaration } from './Declaration';
55
* Default declaration. Is used when a file exports something as its default.
66
* Primary use is to ask the user about a name for the default export.
77
* Is kind of an abstract declaration since there is no real declaration.
8-
*
8+
*
99
* @export
1010
* @class DefaultDeclaration
1111
* @implements {ExportableDeclaration}
1212
*/
1313
export class DefaultDeclaration implements ExportableDeclaration {
1414
public readonly isExported: boolean = true;
1515

16-
private exported: Declaration;
16+
private exported: Declaration | undefined;
1717

1818
public get exportedDeclaration(): Declaration {
1919
if (!this.exported) {
20-
this.exported = this.resource.declarations.find(o => o.name === this.name) !;
20+
this.exported = this.resource.declarations.find(o => o.name === this.name)!;
2121
}
2222

2323
return this.exported;

src/declarations/InterfaceDeclaration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { PropertyDeclaration } from './PropertyDeclaration';
1212
* @implements {GenericDeclaration}
1313
*/
1414
export class InterfaceDeclaration implements ClassLikeDeclaration, ExportableDeclaration, GenericDeclaration {
15-
public accessors: AccessorDeclaration[];
15+
public accessors: AccessorDeclaration[] = [];
1616
public typeParameters: string[] | undefined;
1717
public properties: PropertyDeclaration[] = [];
1818
public methods: MethodDeclaration[] = [];

src/exports/NamedExport.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { Export } from './Export';
33

44
/**
55
* Declares a named export (i.e. export { Foobar } from ...).
6-
*
6+
*
77
* @export
88
* @class NamedExport
99
* @implements {Export}
1010
*/
1111
export class NamedExport implements Export {
12-
public specifiers: SymbolSpecifier[];
12+
public specifiers: SymbolSpecifier[] | undefined;
1313

1414
constructor(public start: number, public end: number, public from: string) { }
1515
}

src/node-parser/class-parser.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
ArrayBindingPattern,
3-
BindingElement,
43
ClassDeclaration,
54
ConstructorDeclaration,
65
Identifier,
@@ -96,8 +95,8 @@ export function parseCtorParams(
9695
} else if (isObjectBindingPattern(o.name) || isArrayBindingPattern(o.name)) {
9796
const identifiers = o.name as ObjectBindingPattern | ArrayBindingPattern;
9897
const elements = [...identifiers.elements];
99-
100-
ctor.parameters = ctor.parameters.concat(<TshParameter[]>elements.map((bind: BindingElement) => {
98+
// TODO: BindingElement
99+
ctor.parameters = ctor.parameters.concat(<TshParameter[]>elements.map((bind: any) => {
101100
if (isIdentifier(bind.name)) {
102101
return new TshParameter(
103102
(bind.name as Identifier).text, undefined, bind.getStart(), bind.getEnd(),

src/node-parser/function-parser.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
ArrayBindingPattern,
3-
BindingElement,
43
FunctionDeclaration,
54
Identifier,
65
MethodDeclaration,
@@ -26,7 +25,7 @@ import { parseVariable } from './variable-parser';
2625
/**
2726
* Parse the parts of a function. All functions / methods contain various information about used variables
2827
* and parameters.
29-
*
28+
*
3029
* @export
3130
* @param {Resource} resource
3231
* @param {(TshConstructor | TshMethod | TshFunction)} parent
@@ -53,8 +52,8 @@ export function parseFunctionParts(
5352
}
5453

5554
/**
56-
* Parse method parameters.
57-
*
55+
* Parse method parameters.
56+
*
5857
* @export
5958
* @param {(FunctionDeclaration | MethodDeclaration | MethodSignature)} node
6059
* @returns {TshParameter[]}
@@ -72,8 +71,8 @@ export function parseMethodParams(
7271
} else if (isObjectBindingPattern(cur.name) || isArrayBindingPattern(cur.name)) {
7372
const identifiers = cur.name as ObjectBindingPattern | ArrayBindingPattern;
7473
const elements = [...identifiers.elements];
75-
76-
params = params.concat(<TshParameter[]>elements.map((o: BindingElement) => {
74+
// TODO: BindingElement
75+
params = params.concat(<TshParameter[]>elements.map((o: any) => {
7776
if (isIdentifier(o.name)) {
7877
return new TshParameter(
7978
(o.name as Identifier).text, undefined, o.getStart(), o.getEnd(),
@@ -90,7 +89,7 @@ export function parseMethodParams(
9089
/**
9190
* Parses a function into its declaration.
9291
* Parses the functions sub information like parameters and variables.
93-
*
92+
*
9493
* @export
9594
* @param {Resource} resource
9695
* @param {FunctionDeclaration} node

src/node-parser/identifier-parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const usageAllowedIfLast = [
2727
SyntaxKind.BinaryExpression,
2828
];
2929

30-
const usagePredicates: any = [
31-
(o: Node) => o.parent && usageNotAllowedParents.indexOf(o.parent.kind) === -1,
30+
const usagePredicates: ((node: Node) => boolean)[] = [
31+
(o: Node) => o.parent !== undefined && usageNotAllowedParents.indexOf(o.parent.kind) === -1,
3232
allowedIfLastIdentifier,
3333
allowedIfPropertyAccessFirst,
3434
];

test/__snapshots__/TypescriptParser.spec.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ Array [
413413

414414
exports[`TypescriptParser Declaration parsing Interfaces should parse a non exported interface 1`] = `
415415
InterfaceDeclaration {
416+
"accessors": Array [],
416417
"end": 130,
417418
"isExported": false,
418419
"methods": Array [
@@ -467,6 +468,7 @@ InterfaceDeclaration {
467468

468469
exports[`TypescriptParser Declaration parsing Interfaces should parse an exported interface 1`] = `
469470
InterfaceDeclaration {
471+
"accessors": Array [],
470472
"end": 286,
471473
"isExported": true,
472474
"methods": Array [

test/declaration-index/specific-cases/reindex-with-global-module/__snapshots__/DeclarationIndex.reindex-with-global-module-export.spec.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ exports[`DeclarationIndex - specific case "reindex-with-global-module" should pa
1717
Array [
1818
DeclarationInfo {
1919
"declaration": InterfaceDeclaration {
20+
"accessors": Array [],
2021
"end": 70,
2122
"isExported": true,
2223
"methods": Array [],

0 commit comments

Comments
 (0)