`makeStyles` and `useTheme` should be typed with the Alteryx `Theme`
- Lenguaje dominante
- JavaScript
- Estrellas
- 6
- Forks
- 0
- Merge medio
- 21 h 41 min
- PR fusionados (30 d)
- 1
Descripción
Currently `makeStyles` and `useTheme` are simply reexported from `@material-ui` and only assume the base MUI `Theme` type. It would be nice if using these functions from `@alteryx/ui` would be typed with Alteryx's extended `Theme` type instead.
```tsx
import { makeStyles, useTheme } from '@alteryx/ui'
const useStyles = makeStyles(theme => ({
foobar: {
// (TS) Property 'passive' does not exist on type 'TypeAction'
color: theme.palette.action.passive
}
}))
const MyComponent = (): JSX.Element => {
const theme = useTheme()
return (
// (TS) Property 'passive' does not exist on type 'TypeAction'
)
}
```
Currently, we have to specify the Alteryx `Theme` type every time.
```tsx
import type { Theme as AyxTheme } from '@alteryx/ui'
import { makeStyles, useTheme } from '@alteryx/ui'
const useStyles = makeStyles((theme: AyxTheme) => ({ ... }))
const theme = useTheme()
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.