-
Alberto Gasparin authored
Part 1 of the conversion. Mostly renaming js to ts and making sure things make still sense. Added also handy TS ESLint rules. In order to support the various .web/.electron/... I ended up adopting `index.d.ts` as pattern to share type definition. Let me know if that makes sense for you too. Right now the function type definition is duplicated, but the solution will be importing from `index.d.ts` and using `const fn: FnDef = () => ...` that way we can keep all variants in sync from a single type file. Such rewrite however is better done in another PR otherwise we risk confusing git and loosing history (rename + too many changes). Another thing that might do in the next PR is convert all files to ESModules, as things get confusing between CJS exports, ESM default/named and TS adds extra complains.
Alberto Gasparin authoredPart 1 of the conversion. Mostly renaming js to ts and making sure things make still sense. Added also handy TS ESLint rules. In order to support the various .web/.electron/... I ended up adopting `index.d.ts` as pattern to share type definition. Let me know if that makes sense for you too. Right now the function type definition is duplicated, but the solution will be importing from `index.d.ts` and using `const fn: FnDef = () => ...` that way we can keep all variants in sync from a single type file. Such rewrite however is better done in another PR otherwise we risk confusing git and loosing history (rename + too many changes). Another thing that might do in the next PR is convert all files to ESModules, as things get confusing between CJS exports, ESM default/named and TS adds extra complains.
accounts.ts 1.10 KiB
export function fromPlaidAccountType(type, subtype) {
switch (type) {
case 'brokerage':
case 'investment':
return 'investment';
case 'credit':
return 'credit';
case 'loan':
return 'debt';
case 'other':
return 'other';
case 'depository':
default:
switch (subtype) {
case 'money market':
case 'savings':
return 'savings';
case 'cd':
return 'cd';
default:
return 'checking';
}
}
}
export function prettyAccountType(type) {
switch (type) {
case 'checking':
return 'Checking';
case 'savings':
return 'Savings';
case 'cd':
return 'CD';
case 'investment':
return 'Investment';
case 'credit':
return 'Credit Card';
case 'mortgage':
return 'Mortgage';
case 'debt':
return 'Debt';
case 'other':
default:
return 'Other';
}
}
export function determineOffBudget(type) {
switch (type) {
case 'investment':
case 'mortgage':
case 'debt':
case 'other':
return true;
default:
}
return false;
}