Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

301
Views
mecanografiado: el tipo de cadena no es un error asignable?

Tengo un archivo de Fonts simple que estoy importando con solo información en este momento que contiene Arial pero contendrá otros más adelante.

Fuentes.ts

 interface Font { [key: string]: { 'full': string, 'trial': string } } interface FontList { [key: string]: Font } export const FONT_LIST: FontList = { 'Arial': { 'Regular': { 'full': 'blahblah', 'trial': 'blahblah' }, 'Bold': { 'full': 'blahblah', 'trial': 'blahblah' }, }, }

En una función, estoy tratando de obtener el valor en función de su derecho

 import { Fonts } from './Fonts' function foo(postscriptName:string, style: string) { const entitlement = "full"; const selectedFont = FONT_LIST[postscriptName][style][entitlement]; return selectedFont; }

Para selectedFont , recibo un error de TS de: Type 'string' is not assignable to type '{ family: string; style: string; postscriptName: string; }'

para depurar, incluso probé selectedFont = FONT_LIST['Arial']['Bold']['full]; para asegurar que los valores estén ahí, pero recibo el mismo error.
Espero volver "blahblah".

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!