Skip to content

Instantly share code, notes, and snippets.

@sinsunsan
Created July 12, 2018 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinsunsan/4d7def74dcce23aa2bb6410932a9046f to your computer and use it in GitHub Desktop.
Save sinsunsan/4d7def74dcce23aa2bb6410932a9046f to your computer and use it in GitHub Desktop.
add function types with typescript
/**
* Hide a column if the column field
* belongs to applicability hidden by default columns
*/
processLeaf(
colDef: ColDef,
columnsSelection: string[],
leafProcess: (visible: boolean, colDef: ColDef) => ColDef
) {
let colDefChanged: ColDef;
if (
(colDef.field && !columnsSelection.includes(colDef.field)) ||
!colDef.field
) {
colDefChanged = leafProcess(false, colDef);
return colDefChanged;
} else {
colDefChanged = colDef;
colDefChanged = leafProcess(true, colDef);
return colDef;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment