Skip to content

Commit

Permalink
Update TypeScript to 5.4.3
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
thgreasi committed Mar 21, 2024
1 parent 2998222 commit 694b370
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"lint-staged": "^13.2.1",
"mocha": "^10.2.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
"typescript": "^5.4.3"
},
"lint-staged": {
"*.js": [
Expand Down
6 changes: 5 additions & 1 deletion src/AbstractSQLCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
SqlResult,
} from './AbstractSQLRules2SQL';
export { Binding, SqlResult } from './AbstractSQLRules2SQL';
import type { SbvrType } from '@balena/sbvr-types';
import sbvrTypes from '@balena/sbvr-types';
import * as _ from 'lodash';
import { optimizeSchema, generateRuleSlug } from './AbstractSQLSchemaOptimiser';
Expand Down Expand Up @@ -580,7 +581,10 @@ const dataTypeValidate: EngineInstance['dataTypeValidate'] = async (
) => {
// In case one of the validation types throws an error.
const { dataType, required = false } = field;
const validateFn = validateTypes[dataType as keyof typeof sbvrTypes];
// Without the `: SbvrType['validate']` widening TS complains that
// "none of those signatures are compatible with each other".
const validateFn: SbvrType['validate'] =
validateTypes[dataType as keyof typeof sbvrTypes];
if (validateFn != null) {
return validateFn(value, required);
} else {
Expand Down

0 comments on commit 694b370

Please sign in to comment.