mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-29 18:19:44 -05:00
Correct type for to-budget field (#3237)
* Correct type for `to-budget` field * Add release notes * Don't enable `strictNullChecks` for now
This commit is contained in:
committed by
GitHub
parent
8142dd1ec9
commit
d1362c3d74
@@ -36,7 +36,7 @@ export function ToBudget({
|
||||
value: 0,
|
||||
});
|
||||
const availableValue = sheetValue;
|
||||
if (typeof availableValue !== 'number') {
|
||||
if (typeof availableValue !== 'number' && availableValue !== null) {
|
||||
throw new Error(
|
||||
'Expected availableValue to be a number but got ' + availableValue,
|
||||
);
|
||||
@@ -83,7 +83,7 @@ export function ToBudget({
|
||||
)}
|
||||
{menuOpen === 'transfer' && (
|
||||
<TransferMenu
|
||||
initialAmount={availableValue}
|
||||
initialAmount={availableValue ?? undefined}
|
||||
onClose={() => setMenuOpen(null)}
|
||||
onSubmit={(amount, categoryId) => {
|
||||
onBudgetAction(month, 'transfer-available', {
|
||||
|
||||
@@ -39,12 +39,12 @@ export function ToBudgetAmount({
|
||||
});
|
||||
const format = useFormat();
|
||||
const availableValue = sheetValue;
|
||||
if (typeof availableValue !== 'number') {
|
||||
if (typeof availableValue !== 'number' && availableValue !== null) {
|
||||
throw new Error(
|
||||
'Expected availableValue to be a number but got ' + availableValue,
|
||||
);
|
||||
}
|
||||
const num = isNaN(availableValue) ? 0 : availableValue;
|
||||
const num = availableValue ?? 0;
|
||||
const isNegative = num < 0;
|
||||
|
||||
return (
|
||||
|
||||
@@ -7,11 +7,7 @@
|
||||
"compilerOptions": {
|
||||
// "composite": true,
|
||||
"target": "ES2022",
|
||||
"lib": [
|
||||
"ES2022",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
@@ -23,10 +19,7 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"skipLibCheck": true,
|
||||
"jsx": "preserve",
|
||||
"types": [
|
||||
"vite/client",
|
||||
"jest"
|
||||
],
|
||||
"types": ["vite/client", "jest"],
|
||||
// Check JS files too
|
||||
"allowJs": true,
|
||||
"checkJs": false,
|
||||
@@ -38,33 +31,27 @@
|
||||
"noEmit": true,
|
||||
"paths": {
|
||||
// until we turn on composite/references
|
||||
"loot-core/*": [
|
||||
"./packages/loot-core/src/*"
|
||||
],
|
||||
"loot-core/*": ["./packages/loot-core/src/*"],
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "typescript-strict-plugin",
|
||||
"path": [
|
||||
"./packages"
|
||||
]
|
||||
}
|
||||
]
|
||||
"path": ["./packages"],
|
||||
},
|
||||
],
|
||||
},
|
||||
"include": [
|
||||
"packages/**/*"
|
||||
],
|
||||
"include": ["packages/**/*"],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/node_modules/*",
|
||||
"**/build/*",
|
||||
"**/client-build/*",
|
||||
"**/dist/*",
|
||||
"**/lib-dist/*"
|
||||
"**/lib-dist/*",
|
||||
],
|
||||
"ts-node": {
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS"
|
||||
}
|
||||
}
|
||||
"module": "CommonJS",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
6
upcoming-release-notes/3237.md
Normal file
6
upcoming-release-notes/3237.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [jfdoming]
|
||||
---
|
||||
|
||||
Fix crash when visiting later months
|
||||
Reference in New Issue
Block a user