Review this 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 its corresponding 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
can be found here and here.
What's the reason behind ESLint flagging "Unsafe assignment of an any
value." and "Unsafe call of an any
typed value." in this line below?
const response = links()