Skip to content

Commit

Permalink
Token List: Add type checking (#18839)
Browse files Browse the repository at this point in the history
* Token List: Add type checking

* Token List: Use documented syntax for optional parameters
  • Loading branch information
aduth authored Dec 7, 2019
1 parent 8e3f1ee commit 2924efa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 4 additions & 6 deletions packages/token-list/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export default class TokenList {
this.value = initialValue;

[ 'entries', 'forEach', 'keys', 'values' ].forEach( ( fn ) => {
this[ fn ] = ( function() {
return this._valueAsArray[ fn ]( ...arguments );
} ).bind( this );
this[ fn ] = ( ...args ) => this._valueAsArray[ fn ]( ...args );
} );
}

Expand Down Expand Up @@ -89,7 +87,7 @@ export default class TokenList {
*
* @param {number} index Index at which to return token.
*
* @return {?string} Token at index.
* @return {string|undefined} Token at index.
*/
item( index ) {
return this._valueAsArray[ index ];
Expand Down Expand Up @@ -138,8 +136,8 @@ export default class TokenList {
*
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-toggle
*
* @param {string} token Token to toggle.
* @param {?boolean} force Presence to force.
* @param {string} token Token to toggle.
* @param {boolean} [force] Presence to force.
*
* @return {boolean} Whether token is present after toggle.
*/
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

},
"include": [
"./packages/url/**/*.js"
"./packages/url/**/*.js",
"./packages/token-list/**/*.js"
],
"exclude": [
"./packages/**/test/**",
Expand Down

0 comments on commit 2924efa

Please sign in to comment.