This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const pkg = require('./package.json'); | |
const { execSync } = require('child_process'); | |
const yarntree = JSON.parse(execSync('yarn list --json')); | |
// 排除的依赖 | |
const exceptList = [ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ComponentType, createElement, forwardRef } from "react"; | |
export default function bindProps<P, PP extends Partial<P>, T = any>(Comp: ComponentType<P>, props: PP) { | |
return forwardRef<T, Omit<P, keyof PP> & Partial<PP>>((p, ref) => createElement(Comp, Object.assign({ ref }, props, p) as unknown as P)) | |
} |