Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

run typecheck in CI #120

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ jobs:
- name: yarn build
run: yarn build
- run: yarn lint
- run: yarn tsc
- name: yarn test (everything)
run: yarn test
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"_agstate/agoric-servers"
],
"devDependencies": {
"@endo/init": "^0.5.33",
"ses": "^0.15.7",
"@typescript-eslint/parser": "^4.19.0",
"ava": "^3.12.1",
Expand All @@ -27,7 +26,7 @@
"@agoric/babel-parser": "^7.6.4",
"babel-eslint": ">=11.0.0-beta.2",
"eslint-plugin-eslint-comments": "^3.1.2",
"typescript": "^4.0.3"
"typescript": "^4.7.2"
},
"engines": {
"node": ">=14.15.0"
Expand Down
18 changes: 18 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "es2020",
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"moduleResolution": "node",
"allowJs": true,
// Enable this to check .js files that don't have @ts-check
// "checkJs": true,
// for React
"allowSyntheticDefaultImports": true,
"jsx": "preserve"
},
"include": ["ui/"],
"exclude": ["**/build", "**/public"]
}

11 changes: 0 additions & 11 deletions ui/jsconfig.json

This file was deleted.

11 changes: 7 additions & 4 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
]
},
"dependencies": {
"@endo/captp": "^1.10.12",
"@agoric/ertp": "dev",
"@endo/eventual-send": "^0.14.4",
"@endo/nat": "^4.1.4",
"@agoric/notifier": "dev",
"@agoric/run-protocol": "dev",
"@agoric/same-structure": "dev",
"@agoric/ui-components": "dev",
"@agoric/wallet-connection": "dev",
"@agoric/zoe": "dev",
"@agoric/run-protocol": "dev",
"@endo/captp": "^2.0.7",
"@endo/eventual-send": "^0.15.3",
"@endo/nat": "^4.1.12",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
Expand Down Expand Up @@ -112,6 +112,9 @@
]
}
},
"jsdoc": {
"mode": "typescript"
},
"react": {
"version": "detect"
}
Expand Down
86 changes: 83 additions & 3 deletions ui/src/types/types.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,83 @@
// @ts-check
/**
* FIXME
*
* @typedef {any} Terms
* @typedef {'instance'} Instance
*/
/**
* @typedef {PromiseLike} ERef<T>
* @template T
*/

/**
* @template {AssetKind} [K=AssetKind]
* @typedef {object} Issuer
*
* The issuer cannot mint a new amount, but it can create empty purses
* and payments. The issuer can also transform payments (splitting
* payments, combining payments, burning payments, and claiming
* payments exclusively). The issuer should be gotten from a trusted
* source and then relied upon as the decider of whether an untrusted
* payment is valid.
*
* @property {() => Brand<K>} getBrand Get the Brand for this Issuer. The
* Brand indicates the type of digital asset and is shared by the
* mint, the issuer, and any purses and payments of this particular
* kind. The brand is not closely held, so this function should not be
* trusted to identify an issuer alone. Fake digital assets and amount
* can use another issuer's brand.
*
* @property {() => string} getAllegedName Get the allegedName for
* this mint/issuer
* @property {() => AssetKind} getAssetKind Get the kind of
* MathHelpers used by this Issuer.
* @property {() => any} getDisplayInfo Give information to UI
* on how to display amounts for this issuer.
* @property {() => any} makeEmptyPurse Make an empty purse of this
* brand.
* @property {any} isLive
* @property {any} getAmountOf
* @property {any} burn
* @property {any} claim
* @property {any} combine
* @property {any} split
* @property {any} splitMany
*/
/**
* @typedef {'nat' | 'set' | 'copySet' | 'copyBag' } AssetKind
*/
/**
* @template {AssetKind} [K=AssetKind]
* @typedef {object} Brand
* @property {(allegedIssuer: ERef<Issuer>) => Promise<boolean>} isMyIssuer
* Should be used with `issuer.getBrand` to ensure an issuer and brand match.
* @property {() => string} getAllegedName
* @property {() => any} getDisplayInfo
*/

/**
* @template {AssetKind} [K=AssetKind]
* @typedef {object} Amount
* Amounts are descriptions of digital assets, answering the questions
* "how much" and "of what kind". Amounts are values labeled with a brand.
* AmountMath executes the logic of how amounts are changed when digital
* assets are merged, separated, or otherwise manipulated. For
* example, a deposit of 2 bucks into a purse that already has 3 bucks
* gives a new purse balance of 5 bucks. An empty purse has 0 bucks. AmountMath
* relies heavily on polymorphic MathHelpers, which manipulate the unbranded
* portion.
*
* @property {Brand<K>} brand
* @property {any} value
*/

/**
* @typedef {object} Ratio
* @property {Amount<'nat'>} numerator
* @property {Amount<'nat'>} denominator
*/

/**
* @typedef {object} CollateralInfo
*
Expand Down Expand Up @@ -40,7 +120,7 @@
* this purse
* @property {Petname} brandPetname the petname for this purse's brand
* @property {Petname} pursePetname the petname for this purse
* @property {any} displayInfo the brand's displayInfo
* @property {import('@agoric/ertp/exported.js').DisplayInfo} displayInfo the brand's displayInfo
* @property {any} value the purse's current balance
* @property {any} currentAmountSlots
* @property {any} currentAmount
Expand Down Expand Up @@ -69,7 +149,7 @@
/**
* @typedef {{
* instance?: Instance,
* ammAPI?: ERef<MultipoolAutoswapPublicFacet>,
* ammAPI?: ERef<unknown>,
* centralBrand?: Brand,
* otherBrands?: Record<string, Brand>,
* }} AutoswapState
Expand Down Expand Up @@ -103,7 +183,7 @@
* treasuryAPI: unknown,
* runIssuer: Issuer,
* runBrand: Brand,
* priceAuthority: ERef<PriceAuthority>,
* priceAuthority: ERef<any>,
* minInitialDebt: Amount<'nat'>,
* debtLimit: Amount<'nat'>,
* }} VaultState
Expand Down
49 changes: 45 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,16 @@
"@endo/nat" "^4.1.8"
"@endo/promise-kit" "^0.2.37"

"@endo/captp@^2.0.7":
version "2.0.7"
resolved "https://registry.yarnpkg.com/@endo/captp/-/captp-2.0.7.tgz#ec17c397a8c9f579771a2301ce8aa4ff9492e3f1"
integrity sha512-gMQe96BfSRUpCBDZtUJiX2ptpL1L91tmd23ooTupRp5L3M1aFO3u0juRO5dGImoTZa8+4iixn43YLxLRa8QRyA==
dependencies:
"@endo/eventual-send" "^0.15.3"
"@endo/marshal" "^0.6.7"
"@endo/nat" "^4.1.12"
"@endo/promise-kit" "^0.2.41"

"@endo/check-bundle@^0.1.2":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@endo/check-bundle/-/check-bundle-0.1.2.tgz#0cdaf1436f858d08ea597081755602df2cdacfdc"
Expand Down Expand Up @@ -2115,6 +2125,11 @@
resolved "https://registry.yarnpkg.com/@endo/eventual-send/-/eventual-send-0.14.8.tgz#0d95b5cd7e420219cdd84c43683bfbd0b6cd2ff6"
integrity sha512-JIbzzIk1/Z+44O7+IuF5HfMzGu1txOvW5IJKu91syk//MIWU1+XQyPhwQKuWiZ2KX+ADdSPyNZTZjAN2IAE8gQ==

"@endo/eventual-send@^0.15.3":
version "0.15.3"
resolved "https://registry.yarnpkg.com/@endo/eventual-send/-/eventual-send-0.15.3.tgz#b6673c0953fca06941b2d06d49aafec6d012af04"
integrity sha512-RAV7Jup9YnFQWD9Po4T8t93eK6qTdvT0evu7j/BD9BfOthhuM18DYtd9j8oz/8qix59KuRKricf+c8WaHNiaog==

"@endo/far@^0.1.5":
version "0.1.5"
resolved "https://registry.yarnpkg.com/@endo/far/-/far-0.1.5.tgz#af2640dffba5cbb326af8ccf9c42831fa9a175f8"
Expand Down Expand Up @@ -2196,6 +2211,20 @@
"@endo/nat" "^4.1.8"
"@endo/promise-kit" "^0.2.37"

"@endo/marshal@^0.6.7":
version "0.6.7"
resolved "https://registry.yarnpkg.com/@endo/marshal/-/marshal-0.6.7.tgz#395366e346a7405ec57cc9057b9f211db54a9409"
integrity sha512-13mFxlWeSI0oOPaVfMNQ2UnNlwHtNf9Jg1Znez7A2o9bDZda0E/CoFyWfQMYbS2o2SWbn8CAjwTBUsjrSJWF7g==
dependencies:
"@endo/eventual-send" "^0.15.3"
"@endo/nat" "^4.1.12"
"@endo/promise-kit" "^0.2.41"

"@endo/nat@^4.1.12":
version "4.1.12"
resolved "https://registry.yarnpkg.com/@endo/nat/-/nat-4.1.12.tgz#172b9552048349ed8a125344fdc72f14e7a30bd0"
integrity sha512-aDVsQK8jaq5WmKPp6CLuKKHPd4bMyX0+p0ZUuvUVnJ7v6OB6VesHF+1v7ss2Rx6XEv8FYuP1OdjJrsI/nQYkVw==

"@endo/nat@^4.1.4":
version "4.1.4"
resolved "https://registry.yarnpkg.com/@endo/nat/-/nat-4.1.4.tgz#7e9c45817b6ddb0332a115600b6e52d500efe9c7"
Expand Down Expand Up @@ -2238,6 +2267,13 @@
dependencies:
ses "^0.15.11"

"@endo/promise-kit@^0.2.41":
version "0.2.41"
resolved "https://registry.yarnpkg.com/@endo/promise-kit/-/promise-kit-0.2.41.tgz#aa8d9f1fafaedf7805fff05432e80d05b582fd57"
integrity sha512-VY3Ov/Ro0r05v8sUGRQnHhuwfwQvtecB3Uhntj2m5ClMeaSFj3hn8XIeWBDRK7jd+/gkCOBtTa67qnrC6ALg4w==
dependencies:
ses "^0.15.15"

"@endo/static-module-record@^0.6.12":
version "0.6.12"
resolved "https://registry.yarnpkg.com/@endo/static-module-record/-/static-module-record-0.6.12.tgz#5b65f89b449ef72fbb985d6beaee4dbc99579844"
Expand Down Expand Up @@ -15737,6 +15773,11 @@ ses@^0.15.11:
resolved "https://registry.yarnpkg.com/ses/-/ses-0.15.11.tgz#851cb6a20d8967537075d25bb0185051c28c23db"
integrity sha512-lQg6q8/PVf+n18EjP+5Uv1tN9oVQ3br5QxJzPXoAVQleSYnlf20JY9coe7n1B9A6CtIKIHyr6m/TfskcRCufgA==

ses@^0.15.15:
version "0.15.15"
resolved "https://registry.yarnpkg.com/ses/-/ses-0.15.15.tgz#082923a1cabeac3151f9b3867e325fe447ce037d"
integrity sha512-sJM4HRlM3VouA3RhRmS7wG5MRQPqZZnc6O4BvAefU7yeM+qp8EUfGAWQ9iB/X5cNh3+m5N9lC7DEpyxQ+E4D+w==

ses@^0.15.7:
version "0.15.7"
resolved "https://registry.yarnpkg.com/ses/-/ses-0.15.7.tgz#53da049638bb34941befd1eccf34647c950f91a2"
Expand Down Expand Up @@ -17029,10 +17070,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@^4.0.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
typescript@^4.7.2:
version "4.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.2.tgz#1f9aa2ceb9af87cca227813b4310fff0b51593c4"
integrity sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==

uglify-js@^3.1.4:
version "3.13.1"
Expand Down