Skip to content

Conversation

@simlu
Copy link
Contributor

@simlu simlu commented Oct 18, 2020

No description provided.

@simlu
Copy link
Contributor Author

simlu commented Oct 18, 2020

There is more work to be done here obviously, but I'm trying to get the basics to work:

  1. coverage works fine with yarn tsv ✔️
  2. the index.d.ts appears to be missing the exported function declaration... I have no idea why that is ✔️
  3. figure out eslint ❌
  4. figure out better declaration (should detail which options can be passed) ❌
  5. some settings are clearly incorrect and need to be fixed ❌

src/index.ts Outdated
};

module.exports = (tree, opts = {}) => {
module.exports = (tree: Object, opts: Object = {}) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that little refactoring here can help to fix the issue with the missed exported function. Try to use this format here:

export default (tree: object, opts: object = {}) => { ... }

Also, note that the object is lowercased, all TS types are written in lowercase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workedfor building, however now I can no longer run my tests. I'm assuming this is because exports["default"] = _default; in the output file.

I'm also a bit confused on Object vs object vs {} in combination with eslint Reference. Eslint does not like : object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I got this working now by fixing the import sytax in the test. It seems that eslint is currently badly misconfigured, so will have to fix that next.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you write Object you refer to JS Object class. And when it is written as object this refers to TS type of plain object with nested props.

tsconfig.json Outdated
"target": "esnext",
"declaration": true,
"allowSyntheticDefaultImports": true,
"module": "none"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to use here CommonJS value instead of none. It's responsible for the output format.

@simlu
Copy link
Contributor Author

simlu commented Oct 19, 2020

Updated the initial comment with outstanding tasks

BREAKING CHANGE: cjs -> esm, dropped node 14
for browser support now use index.min.js
@simlu
Copy link
Contributor Author

simlu commented Jun 14, 2022

closing this for now, typescript support is still very much planned

@simlu simlu closed this Jun 14, 2022
@simlu
Copy link
Contributor Author

simlu commented Sep 13, 2022

@yurist38 I'm doing another attempt at this! You've been very helpful before, and I'd really appreciate if you could take a look at #1072

I'm kind of stuck, getting: Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser

While that error in theory should be easy to resolve - it somehow isn't.

@yurist38
Copy link

I've reviewed your PR, please take a look at my comments. Maybe if you get back to the JSON file, the error will disappear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants