-
Notifications
You must be signed in to change notification settings - Fork 623
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
fix(front-matter): improve extract
types
#5325
fix(front-matter): improve extract
types
#5325
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5325 +/- ##
=======================================
Coverage 95.80% 95.80%
=======================================
Files 458 458
Lines 37852 37864 +12
Branches 5562 5562
=======================================
+ Hits 36264 36276 +12
Misses 1548 1548
Partials 40 40 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, Extractor
should no longer be public.
@@ -3,9 +3,15 @@ | |||
import { createExtractor, type Parser } from "./_create_extractor.ts"; | |||
import { parse as parseYaml } from "@std/yaml/parse"; | |||
import { parse as parseToml } from "@std/toml/parse"; | |||
import type { Extractor } from "./types.ts"; | |||
import type { Extract, Extractor } from "./types.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There no longer seems a reason to export Extractor
.
import type { Extract, Extractor } from "./types.ts"; | |
import type { Extract } from "./types.ts"; |
|
||
export type { Extractor }; | ||
export type { Extract, Extractor }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export type { Extract, Extractor }; | |
export type { Extract }; |
const _extractor = createExtractor({ | ||
yaml: parseYaml as Parser, | ||
toml: parseToml as Parser, | ||
json: JSON.parse as Parser, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const _extractor = createExtractor({ | |
yaml: parseYaml as Parser, | |
toml: parseToml as Parser, | |
json: JSON.parse as Parser, | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto for the other files
I'll do that in a later PR with BREAKING tag. |
Currently in
std/front-matter
packageextract
functions are typed asExtractor
variable, and therefore it doesn't show type information of@params
,@returns
, etc.This PR changes them to functions and improves the docs.
BEFORE
AFTER
This PR also exports
Extract
type (which is return type ofextract
) from each language file. This resolves #5323