I updated CodeMirror dependencies using Yarn 4.1.1 and now I’m getting this weird TypeScript error.
Code:
export const htmlLanguage = languages.find((lang) => lang.name === 'HTML');
Error:
The inferred type of ‘htmlLanguage’ cannot be named without a reference to ‘@codemirror/lang-javascript/node_modules/@codemirror/language’. This is likely not portable. A type annotation is necessary.ts(2742)
Here are the package changes. Relatively minor.
Looks like @codemirror/lang-javascript uses "@codemirror/language": "^6.6.0"
and @codemirror/language-data uses "@codemirror/language": "^6.0.0"
but that wasn’t a problem before and should all resolve properly.
TypeScript thinks everything’s okay if I add this import, but that’s a brittle, weird import.
import { type LanguageDescription as jsLanguageDescription } from '@codemirror/lang-javascript/node_modules/@codemirror/language';
Any ideas as to what the problem could be?