Skip to content

Commit

Permalink
Add optional description to Token (#572)
Browse files Browse the repository at this point in the history
* Add token description for documentation

* Update API

* Undo API change for `getRandomValues`
  • Loading branch information
fcollonval authored Apr 7, 2023
1 parent 41341e8 commit 0a699d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion packages/coreutils/src/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ export class Token<T> {
* Construct a new token.
*
* @param name - A human readable name for the token.
* @param description - Token purpose description for documentation.
*/
constructor(name: string) {
constructor(name: string, description?: string) {
this.name = name;
this.description = description ?? '';
this._tokenStructuralPropertyT = null!;
}

/**
* Token purpose description.
*/
readonly description: string;

/**
* The human readable name for the token.
*
Expand Down
3 changes: 1 addition & 2 deletions packages/polling/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"declarationDir": "types",
"lib": ["DOM", "ES2018"],
"outDir": "lib",
"rootDir": "src",
"types": ["@types/node"]
"rootDir": "src"
},
"include": ["src/*"],
"references": [
Expand Down
3 changes: 2 additions & 1 deletion review/api/coreutils.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ export type ReadonlyPartialJSONValue = JSONPrimitive | ReadonlyPartialJSONObject

// @public
export class Token<T> {
constructor(name: string);
constructor(name: string, description?: string);
readonly description: string;
readonly name: string;
}

Expand Down

0 comments on commit 0a699d6

Please sign in to comment.