Skip to content
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

chore: Separate result options & Improve TSConfig #76

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dimaslanjaka
Copy link
Contributor

@dimaslanjaka dimaslanjaka commented May 13, 2023

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'

chore(deps-dev): update @types/node v18 to latest build

optional options by adding default options empty object
prevent object assign to undefined options variable

fix: TS2345

Argument of type 'string' is not assignable to parameter of type 'never'
prevent IDE indexing `dist`
chore(deps-dev): add `@types/chai`

to easily testing using VSCode or Intellij IDEA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant