mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-21 22:57:17 +01:00
feat(repo): TS 5.5
This commit is contained in:
committed by
Tomáš Martykán
parent
22b96b50b2
commit
198c91f3c4
@@ -98,7 +98,7 @@
|
||||
]
|
||||
},
|
||||
"resolutions": {
|
||||
"typescript": "5.3.3",
|
||||
"typescript": "5.5.4",
|
||||
"react-native": "0.75.2",
|
||||
"prettier": "3.2.5",
|
||||
"type-fest": "4.24.0",
|
||||
@@ -156,7 +156,7 @@
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"tslib": "^2.6.2",
|
||||
"tsx": "^4.16.3",
|
||||
"typescript": "5.3.3",
|
||||
"typescript": "5.5.4",
|
||||
"version-bump-prompt": "^6.1.0"
|
||||
},
|
||||
"dependenciesMeta": {
|
||||
|
||||
@@ -65,7 +65,8 @@ const transformAsset = (asset: Asset) => {
|
||||
* @param {string} amount
|
||||
* @returns {string}
|
||||
*/
|
||||
const transformAmount = (amount: number) => new BigNumber(amount).times(10000000).toString();
|
||||
const transformAmount = (amount: number | string) =>
|
||||
new BigNumber(amount).times(10000000).toString();
|
||||
|
||||
/**
|
||||
* Transforms Memo to TrezorConnect.StellarTransaction.Memo
|
||||
|
||||
@@ -22,19 +22,25 @@ type LastInUnion<U> =
|
||||
? L
|
||||
: never;
|
||||
|
||||
// Build a tuple for the object
|
||||
// Strategy - take the last key, add it to the tuple, and recurse on the rest
|
||||
// Wrap the key in a TLiteral for Typebox
|
||||
type ObjectKeysToTuple<T, Last = LastInUnion<keyof T>> = [T] extends [never]
|
||||
// TLiteral<"a" | "b"> => TLiteral<"a"> | TLiteral<"b">
|
||||
type DistributeLiterals<T extends string | number | symbol> = T extends T
|
||||
? T extends string | number
|
||||
? TLiteral<T>
|
||||
: never
|
||||
: never;
|
||||
|
||||
// TLiteral<"A"> | TLiteral<"B"> => [TLiteral<"A">, TLiteral<"B".]
|
||||
type UnionToTuple<U extends TLiteral, Last = LastInUnion<U>> = [U] extends [never]
|
||||
? []
|
||||
: [Last] extends [never]
|
||||
? []
|
||||
: Last extends string | number
|
||||
? [...ObjectKeysToTuple<Omit<T, Last>>, TLiteral<Last>]
|
||||
: [];
|
||||
: [...UnionToTuple<Exclude<U, Last>>, Last];
|
||||
|
||||
// Explicitly make sure every element is a TLiteral
|
||||
type TLiteralGuard<T extends unknown[]> = {
|
||||
[K in keyof T]: T[K] extends TLiteral<string | number> ? T[K] : never;
|
||||
};
|
||||
|
||||
export interface TKeyOfEnum<T extends Record<string, string | number>>
|
||||
extends TUnion<ObjectKeysToTuple<T>> {
|
||||
extends TUnion<TLiteralGuard<UnionToTuple<DistributeLiterals<keyof T>>>> {
|
||||
[Hint]: 'KeyOfEnum';
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ const solveCubic = (a: number, b: number, c: number, d: number): number[] => {
|
||||
}
|
||||
|
||||
// Convert back from depressed cubic
|
||||
for (let i = 0; i < roots.length; i++) roots[i] -= b / (3 * a);
|
||||
for (let i = 0; i < roots.length; i++) roots[i]! -= b / (3 * a);
|
||||
|
||||
return roots;
|
||||
};
|
||||
|
||||
18
yarn.lock
18
yarn.lock
@@ -40307,7 +40307,7 @@ __metadata:
|
||||
tsconfig-paths: "npm:^4.2.0"
|
||||
tslib: "npm:^2.6.2"
|
||||
tsx: "npm:^4.16.3"
|
||||
typescript: "npm:5.3.3"
|
||||
typescript: "npm:5.5.4"
|
||||
version-bump-prompt: "npm:^6.1.0"
|
||||
dependenciesMeta:
|
||||
core-js-pure:
|
||||
@@ -40739,23 +40739,23 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@npm:5.3.3":
|
||||
version: 5.3.3
|
||||
resolution: "typescript@npm:5.3.3"
|
||||
"typescript@npm:5.5.4":
|
||||
version: 5.5.4
|
||||
resolution: "typescript@npm:5.5.4"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 10/6e4e6a14a50c222b3d14d4ea2f729e79f972fa536ac1522b91202a9a65af3605c2928c4a790a4a50aa13694d461c479ba92cedaeb1e7b190aadaa4e4b96b8e18
|
||||
checksum: 10/1689ccafef894825481fc3d856b4834ba3cc185a9c2878f3c76a9a1ef81af04194849840f3c69e7961e2312771471bb3b460ca92561e1d87599b26c37d0ffb6f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>":
|
||||
version: 5.3.3
|
||||
resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7"
|
||||
"typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>":
|
||||
version: 5.5.4
|
||||
resolution: "typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>::version=5.5.4&hash=b45daf"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 10/c93786fcc9a70718ba1e3819bab56064ead5817004d1b8186f8ca66165f3a2d0100fee91fa64c840dcd45f994ca5d615d8e1f566d39a7470fc1e014dbb4cf15d
|
||||
checksum: 10/2c065f0ef81855eac25c9b658a3c9da65ffc005260c12854c2286f40f3667e1b1ecf8bdbdd37b59aa0397920378ce7900bff8cb32e0f1c7af6fd86efc676718c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user