gatsby-plugin-ts-config icon indicating copy to clipboard operation
gatsby-plugin-ts-config copied to clipboard

Provide an example "opts" object

Open orsi opened this issue 3 years ago • 5 comments

I see the new 2.0 version changes how this plugin works, however, it would be great to see a basic example of what the 'opts' looks like. Is it optional? Does it have default settings?

It's great to know the fields it can take, but there is no mention of what is required.

orsi avatar Sep 03 '21 15:09 orsi

The README lists the available options. They are all optional.

Js-Brecht avatar Sep 03 '21 16:09 Js-Brecht

I know from experimenting with it, my issue is regarding the README no where states that opts is optional. In the examples, there is an opts variable passed but no indication that it is an optional argument, or a small snippet to show what it could look like. If anyone copies and pastes the code snippet examples, opts is always undefined.

orsi avatar Sep 03 '21 17:09 orsi

I show the opts parameter in the example to indicate that it is an available parameter, and what to put there. The examples aren’t generally working code anyway.

I suppose I could add a minimally viable example at the top that people could actually copy. Then have the more “advanced” usage below

Can add a note to the docs to show the entire options parameter is optional too

Js-Brecht avatar Sep 03 '21 17:09 Js-Brecht

Perhaps an API listing would be good to have, as well. They could include the function signature for useGatsbyConfig and useNodeConfig

Js-Brecht avatar Sep 03 '21 17:09 Js-Brecht

Sounds great!

orsi avatar Sep 03 '21 18:09 orsi