- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5
feat: typescript migration #841
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
Conversation
| There is more work to be done here obviously, but I'm trying to get the basics to work: 
 | 
        
          
                src/index.ts
              
                Outdated
          
        
      | }; | ||
|  | ||
| module.exports = (tree, opts = {}) => { | ||
| module.exports = (tree: Object, opts: Object = {}) => { | 
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" | 
There was a problem hiding this comment.
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.
| Updated the initial comment with outstanding tasks | 
BREAKING CHANGE: cjs -> esm, dropped node 14 for browser support now use index.min.js
| closing this for now, typescript support is still very much planned | 
| @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:  While that error in theory should be easy to resolve - it somehow isn't. | 
| 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. | 
No description provided.