how to handle typescript issue
PavelPolyakov opened this issue · comments
Pavel commented
bySabi Files commented
@PavelPolyakov did you solve it?
Pavel commented
@bySabi no, at the end I started to use className
and other pure react properties which are available out of the box.
bySabi Files commented
is a shame.
I really like to copy and paste HTML with class attrs :-)
bySabi Files commented
@PavelPolyakov In the end I could solve it by adding the definition of the class
attribute to the React definitions with:
declare module 'react' {
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
// extends React's HTMLAttributes
class?: string;
}
}
bySabi Files commented
@tkrotoff maybe this is useful to you too. Related to microsoft/TypeScript#9327
bySabi Files commented
and to put in the typings
folder:
import "react";
declare module "react" {
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
// extends React's HTMLAttributes
class?: string;
}
}
Tested with a next.js
based project