Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

370
Visualizações
ESLint: Unsafe assignment of an `any` and Unsafe call of an `any` typed value

Consider the following test code:

import { isHtmlLinkDescriptor } from '@remix-run/react/links'
import invariant from 'tiny-invariant'
import { links } from '~/root'

it('should return a rel=stylesheet', () => {
  const response = links()

  invariant(isHtmlLinkDescriptor(response[0]))

  expect(response[0].rel).toBe('stylesheet')
})

and the implementation:

import { LinksFunction } from 'remix'
import tailwindProdUrl from '~/styles/tailwind.css'

export const links: LinksFunction = () => {
  const href =
    process.env.NODE_ENV !== 'production' ? './tailwind.css' : tailwindProdUrl

  return [{ rel: 'stylesheet', href }]
}

Where LinksFunction is defined here and here.

Why is ESLint complaining about "Unsafe assignment of an any value." and "Unsafe call of an any typed value." in the line below?

const response = links()
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You have a wrong import in the second snippet. It should be:

import { LinksFunction } from '@remix-run/server-runtime';

or also, if you are working with TypeScript 3.8 or later:

import type { LinksFunction } from '@remix-run/server-runtime';

The fact that LinksFunction is being only used as a type in the code you are showing means that the TypeScript compiler could still succeed in compiling your modules under certain circumstances, despite the missing type definitions.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda