-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make VFileContents generic to support processors that return objects #84
Comments
@sandhose this is something I've explored in the past. In general Unified wants to avoid adding generics, for generics sake (for example #47 (comment)), generics should be verifiable. Two things that make this tricky.
From my early tests, generic tuples might offer the possibility make this possible. https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html A few problems: microsoft/TypeScript#26113 and microsoft/TypeScript#5453 are incomplete, which can make extracting the types from lists of plugins and presets difficult. For an example see the following Lines 253 to 261 in 952e15d
unified loses settings type checking in this case. Another potential pit fall is presets. Lines 227 to 236 in 952e15d
which rely on Lines 274 to 279 in 952e15d
Which is another place we currently lose some interferencing. |
The above doesn't necessarily mean that it can't be done. |
I’m going to close this. It’s an issue that needs solving, but I think the proper solution is outlined here: vfile/vfile#45 (comment), and therefore is unrelated to changing vfile’s types for |
Subject of the feature
Right now, compilers that return objects (DOM nodes, React nodes, etc.) can not be type checked correctly. I opened an issue on
vfile
side to make theVFileContent
generic. See vfile/vfile#45.Once fixed on vfile side, we should extend the
Processor
as well as the types related to plugins (Plugin
,Pluggable
,Preset
, etc.) to have aVFile
orVFileContent
type parameter.Related to #47
Problem
Compilers that do not return text are not type checkable.
Expected behaviour
Compilers should be able to override the
VFileContent
type somehow.Alternatives
Casting the output of
process[Sync]().contents
, although it might not work with some strict TS compiler options/linters?The text was updated successfully, but these errors were encountered: