mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
fix: updated field_dropdown to properly infer its Field type with TS 5.3.3 (#7939)
* fix: updated field_dropdown to properly infer its Field type with TS 5.3.3 * fix: removed undefined as an option as its not needed for the type fix * fix: updated field_dropdown to allow |undefined class validation
This commit is contained in:
committed by
GitHub
parent
0ecbcde9fc
commit
b6b57215a8
@@ -408,7 +408,13 @@ export class FieldDropdown extends Field<string> {
|
||||
* @param newValue The input value.
|
||||
* @returns A valid language-neutral option, or null if invalid.
|
||||
*/
|
||||
protected override doClassValidation_(newValue?: string): string | null {
|
||||
protected override doClassValidation_(
|
||||
newValue: string,
|
||||
): string | null | undefined;
|
||||
protected override doClassValidation_(newValue?: string): string | null;
|
||||
protected override doClassValidation_(
|
||||
newValue?: string,
|
||||
): string | null | undefined {
|
||||
const options = this.getOptions(true);
|
||||
const isValueValid = options.some((option) => option[1] === newValue);
|
||||
|
||||
@@ -426,7 +432,7 @@ export class FieldDropdown extends Field<string> {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return newValue as string;
|
||||
return newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -48,7 +48,7 @@
|
||||
"prettier": "3.2.5",
|
||||
"readline-sync": "^1.4.10",
|
||||
"rimraf": "^5.0.0",
|
||||
"typescript": "^5.0.2",
|
||||
"typescript": "^5.3.3",
|
||||
"webdriverio": "^8.32.2",
|
||||
"yargs": "^17.2.1"
|
||||
}
|
||||
@@ -10885,9 +10885,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
|
||||
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz",
|
||||
"integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
"prettier": "3.2.5",
|
||||
"readline-sync": "^1.4.10",
|
||||
"rimraf": "^5.0.0",
|
||||
"typescript": "^5.0.2",
|
||||
"typescript": "^5.3.3",
|
||||
"webdriverio": "^8.32.2",
|
||||
"yargs": "^17.2.1"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user