Skip to content

Commit

Permalink
refactor: More concise duplicateIds typing
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Strayer <[email protected]>
  • Loading branch information
gadenbuie and nstrayer authored Nov 30, 2023
1 parent 1c0c4c3 commit 76abdca
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions srcts/src/shiny/bind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,9 @@ const bindingsRegistry = (() => {
function checkValidity():
| { status: "error"; error: ShinyClientError }
| { status: "ok" } {
const duplicateIds: Map<string, { input: number; output: number }> =
new Map();

const countBindingType = (
types: BindingTypes[],
bindingType: BindingTypes
) => {
return types.filter((type) => type === bindingType).length;
};
type BindingCounts = { [T in BindingTypes]: number };
const duplicateIds = new Map<string, BindingCounts>();


// count duplicate IDs of each binding type
bindings.forEach((idTypes, id) => {
Expand Down

0 comments on commit 76abdca

Please sign in to comment.