kentcdodds / kentcdodds/babel-plugin-codegen

Property value expected type of string but got null

Open
#17 2 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
TypeScript
Stars
347
Forks
27
PR merge metrics
No merged PRs in 30d

Description

- `babel-plugin-codegen` version: ^3.0.0
- `node` version: 10.12.0
- `npm` (or `yarn`) version: 6.4.1

Relevant code or config

```javascript
// @codegen

const hello = 'hello';

module.exports = `
export default {};
`;
```

I was expecting the simple code above to work but it just gives the error mentioned in the title.

![screenshot 2018-10-26 at 17 12 46](https://user-images.githubusercontent.com/1436588/47575429-5f048200-d942-11e8-9d47-2ea46c1f90e4.png)

However, if we remove the line `const hello = 'hello'`, everything works as expected and `export default {};` it's correctly generated

Contributor guide

Open the contributing guide

Research direction

Reproduce the error with the supplied babel-plugin-codegen example, then compare it with the version that removes the `const hello = 'hello'` declaration. Trace how the plugin processes the declaration and identify why it produces a null value instead of accepting the example; done means the original snippet generates `export default {};` without the type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, javascript, node.js
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.