Skip to content

Commit

Permalink
chore: typescript corrections
Browse files Browse the repository at this point in the history
Thanks to Michael Fig.
  • Loading branch information
Chris-Hibbert committed Jun 17, 2021
1 parent bf2dc9e commit 842a5f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/governance/src/paramManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ const parse = paramDesc => {
describers.push(describer);
});

/** @type {() => Record<Keyword,ParamDescription>} */
const getParams = () => {
/** @type {Record<Keyword,ParamDescription>} */
const descriptions = {};
describers.forEach(d => {
const description = d();
Expand Down
6 changes: 4 additions & 2 deletions packages/governance/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
*/

/**
* @typedef {Object} ParamManagerPublic
* ParamManagerPublic also has updateFoo methods for each defined parameter.
* @typedef {Object} ParamManagerBase
* @property {() => Record<Keyword,ParamDescription>} getParams
*
* @typedef {{ [updater: string]: (arg: any) => void }} ParamManagerUpdaters
* @typedef {ParamManagerBase & ParamManagerUpdaters} ParamManagerPublic
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/governance/test/test-param-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ test('params unknown type', async t => {
const stuffDescription = {
name: stuffKey,
value: 'It was the best of times, it was the worst of times',
// @ts-ignore illegal value for testing
type: 'quote',
};
// @ts-ignore illegal value for testing
t.throws(() => buildParamManager([stuffDescription]), {
message: 'unknown type guard "quote"',
});
Expand Down

0 comments on commit 842a5f1

Please sign in to comment.