Skip to content

Commit f36100a

Browse files
author
Michael Wittwer
committed
chore(deps): update to typescript 4.9
BREAKING CHANGE: tslib^2.0.0 is now the minimum required version
1 parent 136b660 commit f36100a

File tree

8 files changed

+72
-26
lines changed

8 files changed

+72
-26
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
node:
2222
- 16
2323
- 18
24-
- 19
2524
name: Node.js v${{ matrix.node }}
2625
runs-on: ubuntu-latest
2726
steps:

package-lock.json

Lines changed: 56 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@
7878
"tsutils": "^3.17.1",
7979
"typedoc": "0.14.0",
8080
"typedoc-plugin-external-module-name": "^2.1.0",
81-
"typescript": ">=2.9.1 <4.0.0"
81+
"typescript": "^4.9.4"
8282
},
8383
"peerDependencies": {
8484
"aws-sdk": "^2.401.0",
8585
"reflect-metadata": "^0.1.12",
86-
"tslib": "^1.10.0"
86+
"tslib": "^2.0.0"
8787
},
8888
"engines": {
8989
"node": ">=18"

src/dynamo/request/batchgetsingletable/batch-get-single-table.request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { BatchGetSingleTableResponse } from './batch-get-single-table.response'
1818
/**
1919
* Request class for BatchGetItem operation which supports a single model class only.
2020
*/
21-
export class BatchGetSingleTableRequest<T, T2 = T> extends BaseRequest<
21+
export class BatchGetSingleTableRequest<T, T2 extends Partial<T> = T> extends BaseRequest<
2222
T,
2323
T2,
2424
DynamoDB.BatchGetItemInput,

src/dynamo/request/get/get.request.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ import { GetResponse } from './get.response'
1515
/**
1616
* Request class for the GetItem operation.
1717
*/
18-
export class GetRequest<T, T2 = T> extends StandardRequest<T, T2, DynamoDB.GetItemInput, GetRequest<T, T2>> {
18+
export class GetRequest<T, T2 extends Partial<T> = T> extends StandardRequest<
19+
T,
20+
T2,
21+
DynamoDB.GetItemInput,
22+
GetRequest<T, T2>
23+
> {
1924
private readonly logger: Logger
2025

2126
constructor(dynamoDBWrapper: DynamoDbWrapper, modelClazz: ModelConstructor<T>, partitionKey: any, sortKey?: any) {

src/dynamo/request/update/update.request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { WriteRequest } from '../write.request'
1515
/**
1616
* Request class for the UpdateItem operation.
1717
*/
18-
export class UpdateRequest<T, T2 = void> extends WriteRequest<
18+
export class UpdateRequest<T, T2 extends T | Partial<T> | void = void> extends WriteRequest<
1919
T,
2020
T2,
2121
DynamoDB.UpdateItemInput,

src/mapper/mapper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function toDb<T>(item: T, modelConstructor?: ModelConstructor<T>): Attrib
4444
* initialize possible properties with default value providers
4545
*/
4646
if (metadata) {
47-
metadata.getPropertiesWithDefaultValueProvider().forEach(propertyMetadata => {
47+
metadata.getPropertiesWithDefaultValueProvider().forEach((propertyMetadata) => {
4848
const currentVal = Reflect.get(<any>item, propertyMetadata.name)
4949
if (currentVal === undefined || currentVal === null) {
5050
// tslint:disable-next-line:no-non-null-assertion
@@ -184,7 +184,7 @@ export function createToKeyFn<T>(modelConstructor: ModelConstructor<T>): (item:
184184
throw new Error(`there is no value for property ${propMeta.name.toString()} but is ${propMeta.key.type} key`)
185185
}
186186
const propertyValue = getPropertyValue(item, propMeta.name)
187-
key[propMeta.nameDb] = <Attribute>toDbOne(propertyValue, propMeta)
187+
;(key as any)[propMeta.nameDb] = <Attribute>toDbOne(propertyValue, propMeta)
188188
return key
189189
}, <Attributes<T>>{})
190190
}
@@ -220,15 +220,15 @@ export function createKeyAttributes<T>(
220220

221221
if (hasSortKey(metadata)) {
222222
if (sortKey === null || sortKey === undefined) {
223-
throw new Error(`please provide the sort key for attribute ${metadata.getSortKey()}`)
223+
throw new Error(`please provide the sort key for attribute ${String(metadata.getSortKey())}`)
224224
}
225225
const sortKeyProp = metadata.getSortKey()
226226
const sortKeyMetadata = metadata.forProperty(sortKeyProp)
227227
if (!sortKeyMetadata) {
228228
throw new Error('metadata for sort key must be defined')
229229
}
230230

231-
keyAttributeMap[sortKeyMetadata.nameDb] = <Attribute>toDbOne(sortKey, sortKeyMetadata)
231+
;(keyAttributeMap as any)[sortKeyMetadata.nameDb] = <Attribute>toDbOne(sortKey, sortKeyMetadata)
232232
}
233233

234234
return keyAttributeMap

src/mapper/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export function getPropertyPath<T>(
2121
propertyKey: keyof T,
2222
): string {
2323
if (modelConstructorOrPropertyMetadata && modelConstructorOrPropertyMetadata.name) {
24-
return `[${modelConstructorOrPropertyMetadata.name}::${propertyKey}]`
24+
return `[${String(modelConstructorOrPropertyMetadata.name)}::${String(propertyKey)}]`
2525
} else {
26-
return `[unknown::${propertyKey}]`
26+
return `[unknown::${String(propertyKey)}]`
2727
}
2828
}
2929

0 commit comments

Comments
 (0)