You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the focusMode property of Table2 has issues.
Trying to use the enum <Table2 focusMode={FocusMode.ROW} /> results in:
error TS1362: 'FocusMode' cannot be used as a value because it was exported using 'export type'.
197 focusMode={FocusMode.ROW}
~~~~~~~~~
node_modules/@blueprintjs/table/lib/esm/common/index.d.ts:1:56
1 export type { CellCoordinates, FocusedCellCoordinates, FocusMode } from "./cellTypes";
~~~~~~~~~
'FocusMode' was exported here.
Trying to use the literal value assigned to FocusMode.ROW:
error TS2322: Type '"row"' is not assignable to type 'FocusMode | undefined'.
197 focusMode="row"
~~~~~~~~~
Using "row" as FocusMode works, but it defeats the typing engine and allows any value to be passed in. For example, focusMode={"foobar" as FocusMode} compiles just fine.
Environment
@blueprintjs/core: 5.16.6
@blueprintjs/table: 5.3.5
@blueprintjs/table: 5.3.5
typescript: 5.7.3
Possible solution
The FocusMode export chain looks like this:
defined in and exported as a value from @blueprintjs/table/lib/esm/common/cellTypes.d.ts
re-exported as a type from @blueprintjs/table/lib/esm/common/index.d.ts`
re-exported as a type from @blueprintjs/table/lib/esm/index.d.ts
I believe that the re-exports as a type are an oversight and re-exporting the enum as a value fixes the problem and allows the usage as focusMode={FocusMode.ROW}.
Tested by patching the installed files:
node_modules/@blueprintjs/table/lib/esm/common/index.d.ts: remove "type" in export
node_modules/@blueprintjs/table/lib/esm/common/index.js: add a new export for FocusMode
node_modules/@blueprintjs/table/lib/esm/index.d.ts: remove "type" in export
node_modules/@blueprintjs/table/lib/esm/index.js: add a new export for FocusMode
The text was updated successfully, but these errors were encountered:
Using the
focusMode
property ofTable2
has issues.<Table2 focusMode={FocusMode.ROW} />
results in:FocusMode.ROW
:"row" as FocusMode
works, but it defeats the typing engine and allows any value to be passed in. For example,focusMode={"foobar" as FocusMode}
compiles just fine.Environment
Possible solution
The
FocusMode
export chain looks like this:@blueprintjs/table/lib/esm/common/cellTypes.d.ts
@blueprintjs/table/lib/esm/index.d.ts
I believe that the re-exports as a type are an oversight and re-exporting the enum as a value fixes the problem and allows the usage as
focusMode={FocusMode.ROW}
.Tested by patching the installed files:
node_modules/@blueprintjs/table/lib/esm/common/index.d.ts
: remove "type" in exportnode_modules/@blueprintjs/table/lib/esm/common/index.js
: add a new export forFocusMode
node_modules/@blueprintjs/table/lib/esm/index.d.ts
: remove "type" in exportnode_modules/@blueprintjs/table/lib/esm/index.js
: add a new export forFocusMode
The text was updated successfully, but these errors were encountered: