Uh oh!
There was an error while loading. Please reload this page.
[WIP] Next Major Release - #39
Conversation
drop tsdx in favor of custom build, due to lack of TS4 and limited ESM support
Uh oh!
There was an error while loading. Please reload this page.
karlhorky
commented
Feb 18, 2024
@ChristianMurphy would it be possible to get an alpha/canary release of this before the final version is ready? I would be willing to test the current state of this out on our projects. |
ChristianMurphy
commented
Feb 18, 2024
Welcome @karlhorky! 👋 To your implied question of when will this PR land? |
| "husky": "^7.0.0", | ||
| "katex": "^0.13.0", | ||
| "pinst": "^2.0.0", | ||
| "prettier": "^2.0.0", |
There was a problem hiding this comment.
Because this PR came before v3 was released 🙂
V3 would be good to include
| "lint": "tsdx lint", | ||
| "prepare": "tsdx build", | ||
| "build": "tsc && type-coverage", | ||
| "test": "node --loader ts-node/esm ./test/index.test.ts", |
There was a problem hiding this comment.
I'd recommend to use lite https://github.com/privatenumber/tsx over ts-node, types linting can be a seperate task via tsc.
There was a problem hiding this comment.
I agree, though neither will be needed in the end.
The goal is:
migrate TypeScript files to JavaScript with JSDoc based Typescript
Ok, thanks for the response. Which files would be the minimum files to get converted to JSDoc Based TypeScript to get this working on a commit install? Just |
WorkaroundUntil this is published, I'm using this code for
import{ReactElement}from'react';import*asprodfrom'react/jsx-runtime';importrehypeReact,{Components,OptionsasRehypeReactOptions,}from'rehype-react';importremarkGfmfrom'remark-gfm';importremarkParse,{OptionsasRemarkParseOptions}from'remark-parse';importremarkToRehype,{OptionsasRemarkRehypeOptions}from'remark-rehype';import{PluggableList,unified}from'unified';// Copied + modfied from:// - https://github.com/remarkjs/react-remark/pull/39/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R37//// Modifications:// - Removed Omit<>/PartialBy<> used on rehypeReactOptions// - Removed `?? true` from remarkToRehypeOptions// - Fixed option values for rehypeReact// - Used Partial<> with rehypeReactOptions//// TODO: Remove when PR #39 is merged or a new version is// released, making react-remark compatible with the other// plugins again// - https://github.com/remarkjs/react-remark/pull/39// - https://github.com/remarkjs/react-remark/issues/50#issuecomment-1123725393// - https://github.com/remarkjs/react-remark/issues/54#issuecomment-1654923707// - https://github.com/remarkjs/react-remark/issues/41interfaceUseRemarkSyncOptions{remarkParseOptions?: RemarkParseOptions;remarkToRehypeOptions?: RemarkRehypeOptions;rehypeReactOptions?: Partial<RehypeReactOptions>;remarkPlugins?: PluggableList;rehypePlugins?: PluggableList;}constuseRemarkSync=(source: string,{
remarkParseOptions,
remarkToRehypeOptions,
rehypeReactOptions,
remarkPlugins =[],
rehypePlugins =[],}: UseRemarkSyncOptions={},): ReactElement=>unified().use(remarkParse,remarkParseOptions).use(remarkPlugins).use(remarkToRehype,remarkToRehypeOptions).use(rehypePlugins).use(rehypeReact,{// @ts-expect-error: the react types are missing.Fragment: prod.Fragment,// @ts-expect-error: the react types are missing.jsx: prod.jsx,// @ts-expect-error: the react types are missing.jsxs: prod.jsxs,
...rehypeReactOptions,}asRehypeReactOptions).processSync(source).resultasReactElement;// Copied code ends heretypeProps={children: string;components: Partial<Components>;};exportdefaultfunctionRemark(props: Props){constreactContent=useRemarkSync(props.children,{remarkPlugins: [remarkGfm],rehypeReactOptions: {components: {
...props.components,},},});returnreactContent;} |
drop tsdx in favor of custom build, due to lack of TS4 and limited ESM
support
Initial checklist
Description of changes
migrate tsdx text to uvu or jestnode:test.d.tsfile rehypejs/rehype-react#30 and Fix to correctly compile intrinsic types rehypejs/rehype-react#31