Accepted answer

Typescript already has a definition of the types that are allowed in a button so you have to declare an enum which matches with the available types:

import React from 'react';

enum ButtonTypes {

interface IProps {
  text: string,
  type: ButtonTypes

const Button = ({ text, ...otherProps }: IProps) => (
  <button {...otherProps}>
    { text }

export default Button;

You can read more on enums here.

Related Query

More Query from same tag