hexo-front-matter
hexo-front-matter copied to clipboard
chore: Separate result options & Improve TSConfig
chore: separate result type and make options as optional
separate result type and make options
as optional by adding default options an empty object. Prevent assign to undefined variable.
fix: types node
install @types/node
instead override type: node
. this method will fixed typescript build for both single project or workspaces/monorepo project.
refactor: enable esModuleInterop
-
the ES6 modules spec states that a namespace import (
import * as x
) can only be an object, by having TypeScript treating it the same as= require("x")
then TypeScript allowed for the import to be treated as a function and be callable. That's not valid according to the spec. -
while accurate to the ES6 modules spec, most libraries with CommonJS/AMD/UMD modules didn't conform as strictly as TypeScript's implementation.
Turning on esModuleInterop
will fix both of these problems in the code transpiled by TypeScript. see more
fix: failed build caused by libs in node_modules on both single
or monorepo
project
modify tsconfig.json
to skip typechecking on node_modules
.
sample useless errors while compiling (npm run build
)
node_modules/@types/hexo/dist/hexo/index.d.ts:4:22 - error TS2307: Cannot find module 'warehouse' or its corresponding type declarations.
actually this package doesnt include warehouse
, but look the above errors.
https://github.com/dimaslanjaka/hexo-front-matter/blob/64c2a6940366909c262e914e967c95233cbd9570/lib/front_matter.ts#L1-L4
above error occurs while used the repo inside workspace
/monorepo
tree project, not single project.
this will fixed develop on both monorepo or single project.
fix: TS2345
Argument of type 'string' is not assignable to parameter of type 'never'