GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Differing types in main schema and create cause TypeScript problems · Issue #3623 · feathersjs/feathers Open Description// Main data model schema export const companySchema = Type.Object( { id: Type.Number(), count: Type.String() //Stored as string in DB for example }, { $id: 'Company', additionalProperties: false } ) // Schema for creating new entries export const companyDataSchema = Type.Object( { text: Type.String(), count: Type.Number() // Taken as number by API }, { $id: 'CompanyData', additionalProperties: false } ) export type CompanyData = Static<typeof companyDataSchema> //Type error - Type string is not assignable to type PromiseOrLiteral<number | undefined> export const companyDataResolver = resolve<CompanyData, HookContext<CompanyService>>({ count: (value, obj, context, status) => { return value + ' People' } }) Similarly, if you have differing types between the main and create schema. create: [ async (context, next) => { const result = context.result // result is type any await next() } ] Types should never fallback into ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |