An npm install followed by npm test results in the type errors below during compilation. The release model create() and update() functions expect a generic body object, but the API post() and patch() methods expect the body to be an AnyObject.
$ npm test
> @balena/compose@2.1.1 test /home/kbee/dev/balena-compose/test-repo
> npm run lint && ts-mocha --project ./tsconfig.test.json
> @balena/compose@2.1.1 lint /home/kbee/dev/balena-compose/test-repo
> npm run lint:lib && npm run lint:tests && tsc --noEmit
> @balena/compose@2.1.1 lint:lib /home/kbee/dev/balena-compose/test-repo
> balena-lint --typescript lib/ typings/
Warning: The 'no-floating-promises' rule requires type information.
0 errors and 0 warnings in 4 files
> @balena/compose@2.1.1 lint:tests /home/kbee/dev/balena-compose/test-repo
> balena-lint --typescript --tests test/
Warning: The 'no-floating-promises' rule requires type information.
0 errors and 0 warnings in 18 files
lib/release/models.ts:122:30 - error TS2322: Type 'U' is not assignable to type 'AnyObject | undefined'.
Type 'U' is not assignable to type 'AnyObject'.
122 return api.post({ resource, body }).catch(wrapResponseError) as Promise<T>;
~~~~
lib/release/models.ts:117:27
117 export function create<T, U>(
~
This type parameter might need an `extends AnyObject` constraint.
lib/release/models.ts:117:27
117 export function create<T, U>(
~
This type parameter might need an `extends AnyObject | undefined` constraint.
node_modules/pinejs-client-core/index.d.ts:231:5
231 body?: AnyObject;
~~~~
The expected type comes from property 'body' which is declared here on type 'Params'
lib/release/models.ts:131:35 - error TS2322: Type 'T' is not assignable to type 'AnyObject | undefined'.
Type 'T' is not assignable to type 'AnyObject'.
131 return api.patch({ resource, id, body }).catch(wrapResponseError);
~~~~
lib/release/models.ts:125:24
125 export function update<T>(
~
This type parameter might need an `extends AnyObject` constraint.
lib/release/models.ts:125:24
125 export function update<T>(
~
This type parameter might need an `extends AnyObject | undefined` constraint.
node_modules/pinejs-client-core/index.d.ts:231:5
231 body?: AnyObject;
~~~~
The expected type comes from property 'body' which is declared here on type 'Params'
Found 2 errors in the same file, starting at: lib/release/models.ts:122
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @balena/compose@2.1.1 lint: `npm run lint:lib && npm run lint:tests && tsc --noEmit`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @balena/compose@2.1.1 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/kbee/.npm/_logs/2022-09-03T11_10_58_831Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @balena/compose@2.1.1 test: `npm run lint && ts-mocha --project ./tsconfig.test.json`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @balena/compose@2.1.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/kbee/.npm/_logs/2022-09-03T11_10_58_846Z-debug.log
An
npm install
followed bynpm test
results in the type errors below during compilation. The release model create() andupdate()
functions expect a genericbody
object, but the API post() andpatch()
methods expect the body to be an AnyObject.