相关疑难解决方法(0)

带有 Typescript 的 Reactjs 中“重复字符串索引签名”的错误

我在 Reactjs 使用 Typescript 创建了一个对象。
下面有一个代码。
但是它会在从密码到姓氏的 UserInformation 数据中出现此错误。
你能给我一些建议吗?

重复字符串索引签名

import { observable, action } from 'mobx';

export interface ISignStore {
  email: string,
  password: string,
  firstName: string,
  lastName: string,
  handleInput(e: any): void,
  handleSubmit(e: any): void
}

export class SignStore implements ISignStore {
  @observable
  UserInformation: {
    [email: string]: '',
    [password: string]: '',
    [firstName: string]: '',
    [lastName: string]: ''
  };

  @action
  handleInput = (e: any): void => {
    [e.target.id] = e.target.value;
  };

  @action
  handleSubmit = (e: any): void => {
    e.preventDefault(); …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs mobx

1
推荐指数
1
解决办法
5575
查看次数

标签 统计

mobx ×1

reactjs ×1

typescript ×1