Búsqueda de sitios web

typescript - Tipo de imagen requerida en React-Native MobX-state-tree: "Posible rechazo de promesa no manejado"


Probablemente lo estoy haciendo mal, pero ¿cuál es el tipo de una "imagen" en un modelo de mobx-state-tree?
¿Cómo puedo agregar una propiedad a un modelo MST en react-native para contener una imagen estática?

const default_img = {
  img1: require("./images/01.png"),
  img2: require("./images/02.png")
}

const userData = [{
  id: 1,
  name: "name1",
  avatar: default_img.img1
},{
  id: 2,
  name: "name2",
  avatar: default_img.img2
},
}]


export const UserModel = types.model({
  id: types.identifierNumber,
  name: types.string,
  avatar: types.maybe(types.string) // <-- this the error below
})

export const RootStoreModel = types.model("RootStore").props({
  users: types.array(UserModel)
}).actions(self => ({
  afterCreate() {
    self.users = userData
  }
}))

Error:

Possible Unhandled Promise Rejection (id:0):
Error: [mobx-state-tree] Error while converting `...` to `AnonymousModel[]``
at path `...` value is not assignable to type `(string | undefined)` (No type is applicable for the union)