Skip to content

Commit 3219168

Browse files
authored
Typescript now reads type information without error. #968 (#980)
* docs: Modified jsdoc to be as per current types.d.ts. * A little processing has been added so that TokenNames are defined as constants. * NullSafePropertyLookup has renamed its constructor. * docs: npm run build-types * docs: fix typo, and define type. * chore: add type check in github actions. * chore: npm run test -- --updateSnapshot * chore: add diff check for types.d.ts. * docs: fix style.
1 parent e2b7453 commit 3219168

39 files changed

+363
-345
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ jobs:
2424
yarn
2525
yarn test
2626
27+
- name: type check
28+
run: |
29+
npm i -g typescript
30+
yarn build-types
31+
[ $(git diff types.d.ts | wc -l) -gt 0 ] && echo 'Diff exists in types.d.ts. Please change jsdoc.' && exit 1
32+
tsc --noEmit types.d.ts
33+
2734
- name: install valgrind
2835
run: sudo apt-get install -y valgrind
2936

src/ast/array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const KIND = "array";
3131
* ]
3232
* }
3333
* @extends {Expression}
34-
* @property {Entry|Expression|Variable} items List of array items
34+
* @property {Array<Entry|Expression|Variable>} items List of array items
3535
* @property {boolean} shortForm Indicate if the short array syntax is used, ex `[]` instead `array()`
3636
*/
3737
module.exports = Expr.extends(

src/ast/attrgroup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const KIND = "attrgroup";
1010

1111
/**
1212
* Attribute group
13+
* @memberOf module:php-parser
1314
* @constructor AttrGroup
1415
* @extends {Node}
1516
* @property {Attribute[]} attrs

src/ast/attribute.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const KIND = "attribute";
1010

1111
/**
1212
* Attribute Value
13+
* @memberOf module:php-parser
1314
* @constructor Attribute
1415
* @extends {Node}
1516
* @property {String} name

src/ast/boolean.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const KIND = "boolean";
1313
* @constructor Boolean
1414
* @memberOf module:php-parser
1515
* @extends {Literal}
16+
* @property {boolean} value
1617
*/
1718
module.exports = Literal.extends(
1819
KIND,

src/ast/call.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const KIND = "call";
1414
* @memberOf module:php-parser
1515
* @extends {Expression}
1616
* @property {Identifier|Variable} what
17-
* @property {Variable[]} arguments
17+
* @property {Expression[]} arguments
1818
*/
1919
module.exports = Expression.extends(
2020
KIND,

src/ast/catch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ const KIND = "catch";
1313
* @constructor Catch
1414
* @memberOf module:php-parser
1515
* @extends {Statement}
16-
* @property {Identifier[]} what
17-
* @property {Variable|null} variable
18-
* @property {Statement} body
16+
* @property {Name[]} what
17+
* @property {Variable} variable
18+
* @property {Block} body
1919
* @see http://php.net/manual/en/language.exceptions.php
2020
*/
2121
module.exports = Statement.extends(

src/ast/class.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ const KIND = "class";
1414
* @memberOf module:php-parser
1515
* @extends {Declaration}
1616
* @property {Identifier|null} extends
17-
* @property {Identifier[]} implements
17+
* @property {Identifier[]|null} implements
1818
* @property {Declaration[]} body
19-
* @property {AttrGroup[]} attrGroups
2019
* @property {boolean} isAnonymous
2120
* @property {boolean} isAbstract
2221
* @property {boolean} isFinal
22+
* @property {AttrGroup[]} attrGroups
2323
*/
2424
module.exports = Declaration.extends(
2525
KIND,

src/ast/declare.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const KIND = "declare";
1313
* @constructor Declare
1414
* @memberOf module:php-parser
1515
* @extends {Block}
16-
* @property {Array[]} directives
17-
* @property {String} mode
16+
* @property {DeclareDirective[]} directives
17+
* @property {string} mode
1818
* @see http://php.net/manual/en/control-structures.declare.php
1919
*/
2020
const Declare = Block.extends(

src/ast/declaredirective.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const KIND = "declaredirective";
1313
* @constructor DeclareDirective
1414
* @memberOf module:php-parser
1515
* @extends {Node}
16-
* @property {Identifier} name
16+
* @property {Identifier} key
1717
* @property {Node|string|number|boolean|null} value
1818
*/
1919
module.exports = Node.extends(

0 commit comments

Comments
 (0)