I encountered a TypeScript error stating
Property 'UPDATE_COLUMNS' does not exist on type 'DimensionAction'.ts(2339)
, even though it is clearly defined above.
This issue occurred while using VSCode. I'm starting to suspect it may be an IDE bug, as running yarn lint
reveals that the syntax in all other parts of my code is correct.
https://i.sstatic.net/ooTSp.png
export enum DimensionAction {
UPDATE_ROWS = 'update_rows',
UPDATE_COLUMNS = 'update_columns',
}
const dimensionReducer = (state: Dimension, action: DimensionAction): void => {
switch (action) {
case action.UPDATE_COLUMNS:
break
case action.UPDATE_ROWS:
break
default:
throw Error('Must pass action')
}
}
What could be causing this TypeScript validation error?