Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Typescript: Add comments to typings #302

Closed
luke-john opened this issue Aug 23, 2017 · 10 comments
Closed

Typescript: Add comments to typings #302

luke-john opened this issue Aug 23, 2017 · 10 comments

Comments

@luke-john
Copy link
Collaborator

Problem description:

The current typings for glamorous don't have much in the way of comments, it would be good to add comments to the typings to improve the user experience.

As an example WithComponent in glamorous-component.ts could be improved as follows.

export interface WithComponent<ExternalProps, Props> {
  /**
   * Copy the styles of an already created glamorous component with a different tag.
   */
  withComponent: (
    component: string | Component<Props>
  ) => GlamorousComponent<

Which would add the handy description to users

screen shot 2017-08-23 at 6 58 07 pm

@Powell-v2
Copy link
Contributor

Hi there! I'd like to help out with this task (if still relevant), however I'm not entirely sure how to come up with proper comments ... Could you provide a little bit of guidance, please?

@luke-john
Copy link
Collaborator Author

Hey @Powell-v2, yes the glamorous typings could definitely still do with better comments, so if you'd be willing to help out with those that would be greatly appreciated ❤️ .

A couple of initial wins here would be to add some comments to the following interfaces;

withProps

withProps?: DefaultProps

withProps: DefaultProps

withProps: <DefaultProps extends object>(

propsAreCssOverrides

propsAreCssOverrides?: false

propsAreCssOverrides: true

The comments on the following page for the various options/interfaces have been derived from the glamorous documentation and may be a good starting point https://glamorous-lunch-and-learn.stackblitz.io/#5

@Powell-v2
Copy link
Contributor

Thanks @luke-john , I'm on it then : )

@Powell-v2
Copy link
Contributor

Hi @luke-john, yesterday I was trying to set up the project locally for the first time but encountered an error while running "validate" script. Asked on gitter channel, but nobody got back to me. Maybe you could advise?
I was only following instructions in the guide for contributors (so stuck on step 3). Here is the error message I've got:

> glamorous@0.0.0-semantically-released validate /Users/powell_v2/Downloads/glamorous
> kcd-scripts validate lint,build-and-test,test:cover

/Users/powell_v2/Downloads/glamorous/node_modules/kcd-scripts/dist/utils.js:135
  scripts = Object.entries(scripts).reduce(function (all, _ref3) {
                   ^

TypeError: Object.entries is not a function
    at getConcurrentlyArgs (/Users/powell_v2/Downloads/glamorous/node_modules/kcd-scripts/dist/utils.js:135:20)
    at Object.<anonymous> (/Users/powell_v2/Downloads/glamorous/node_modules/kcd-scripts/dist/scripts/validate.js:32:53)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)

@luke-john
Copy link
Collaborator Author

Hey @Powell-v2, sorry about that.

I suspect this is due to kcd-scripts relying on javascript features which are not present in the version of node you're using.

Are you able to try with node v8?

@Powell-v2
Copy link
Contributor

Powell-v2 commented Jan 4, 2018

That helped, thanks! However validate script complained about unresolved path:

[lint] 
[lint] /Users/powell_v2/Downloads/glamorous/other/codemods/theme-move.test.js
[lint]   3:22  error  Unable to resolve path to module 'prettier'  import/no-unresolved
[lint] 
[lint] ✖ 1 problem (1 error, 0 warnings)
[lint] 
[lint] npm run lint --silent exited with code 1

Should I ignore it or it has to be fixed before I create a PR?

@luke-john
Copy link
Collaborator Author

luke-john commented Jan 4, 2018 via email

@kentcdodds
Copy link
Contributor

My guess is that you're running an old version of npm that's not installing dependencies in a way that kcd-scripts expects them to be installed. Make sure you're on the latest stable node (>=8) and npm (>= 5). Sorry about that!

@Powell-v2
Copy link
Contributor

Thanks @kentcdodds, I had node v6.x - updating to the latest stable version fixed the issue 👍

@kentcdodds
Copy link
Contributor

This project is now in an unmaintained status. Please see the README for more information.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants