@adobe/data - v0.10.30
    Preparing search index...

    Function create

    • Creates a Store schema with optional properties. All schema properties (components, resources, archetypes, indexes) are optional and default to empty objects when not provided.

      Type Parameters

      • const CS extends ComponentSchemas = {}
      • const RS extends ResourceSchemas = {}
      • const A extends ArchetypeComponents<
            StringKeyof<
                CS & {} & IntersectTuple<
                    {
                        [K in string
                        | number
                        | symbol]: D[K<K>] extends Store.Schema<C, any, any, any> ? C : never
                    },
                >,
            >,
        > = {}
      • const IX extends IndexDeclarations<
            FromSchemas<
                CS & {} & IntersectTuple<
                    {
                        [K in string
                        | number
                        | symbol]: D[K<K>] extends Store.Schema<C, any, any, any> ? C : never
                    },
                >,
            >,
            A,
        > = {}
      • const D extends readonly Store.Schema<any, any, any, any>[] = []

      Parameters

      • schema: Partial<{ archetypes: A; components: CS; indexes: IX; resources: RS }>

        Partial store schema. Omit any properties you don't need.

      • Optionaldependencies: D

        Optional array of schemas to merge with. Properties from dependencies are merged with the schema, with dependencies taking precedence for overlapping properties.

      Returns Intersect<
          [
              Store.Schema<
                  CS & {} & IntersectTuple<
                      {
                          [K in string
                          | number
                          | symbol]: D[K<K>] extends Store.Schema<C, any, any, any> ? C : never
                      },
                  >,
                  RS,
                  A,
                  IX,
              >,
              ...D[],
          ],
      >

      The merged schema with all properties from the schema and dependencies

      // Minimal schema with only components
      const schema = Store.Schema.create({
      components: {
      position: { type: "number" }
      }
      });

      // Schema with dependencies
      const extended = Store.Schema.create({
      components: { velocity: { type: "number" } }
      }, [baseSchema]);