Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
schemaTypes in sanity io

I am facing problem in schemaTypes of Sanity io All the details are mentioned below Any problem regarding the question U can ask me

userSchema.js

    name:'abouts',
    title:'Abouts',
    type: 'document',
    fields:[
        {
            name:'title',
            title:'Title',
            type:'string'
        },
        {
            name:'description',
            title:'Description',
            type:'string'
        },
        {
            name:'imgUrl',
            title:'ImgUrl',
            type: 'image',
            options: {
              hotspot: true,
            },
        },

    ]
} 

schema.js

import createSchema from 'part:@sanity/base/schema-creator'
import schemaTypes from 'all:part:@sanity/base/schema-type'
import { userSchema } from './userSchema'

export default createSchema({
  
  name: 'default',
  types: schemaTypes.concat([userSchema]),
}) 

Now, schemaTypes is an OBJECT as we can check from "typeof" operator, I dont understand how can we use .concat() with an Object, like .concat() is an array function which can be applied with Array, So how schemaTypes.concat([userSchema]) is working correctly??

Please help me regarding this. Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In JavaScript you will never get 'array' back from typeof. typeof will return 'object' for any non-primitive other than functions (and the primitive null).

What I expect you are looking for is the Array.isArray() method. Logging Array.isArray(schemaTypes) should return true, meaning that schemaTypes is in fact an array and can use the .concat() method.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda