Skip to content
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

JSDoc #26

Open
anthonyjoeseph opened this issue Apr 9, 2022 · 3 comments
Open

JSDoc #26

anthonyjoeseph opened this issue Apr 9, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@anthonyjoeseph
Copy link
Owner

examples from where?

  • readme
  • blog post
  • tests
@anthonyjoeseph anthonyjoeseph added the documentation Improvements or additions to documentation label Apr 9, 2022
@ivklgn
Copy link

ivklgn commented Apr 9, 2022

@anthonyjoeseph this is good one https://codesandbox.io/s/spectacles-ts-experiments-krc1x9?file=/src/experiments.ts

but from tests is better

@ivklgn
Copy link

ivklgn commented Apr 11, 2022

@anthonyjoeseph im ready to contribute jsdoc.
what kind of format?

@anthonyjoeseph
Copy link
Owner Author

Oh wow that would be great! I think something modelled after fp-ts

/**
 * Sets a value at a particular path
 * 
 * If a value at the path doesn't exist, return O.none, otherwise wrap the result in O.some
 *
 * @example
 * import { pipe } from 'fp-ts/function'
 * import * as O from 'fp-ts/Option'
 * import { setOption } from 'spectacles-ts/set'
 * 
 * type Data = { a?: { b: number } }
 * 
 * assert.strictEqual(
 *   pipe(
 *     { a: { b: 123 } } as Data,
 *     setOption('a.b', 456)
 *   ),
 *   O.some({ a: { b: 456 } })
 * )
 * assert.strictEqual(
 *   pipe(
 *     {} as Data,
 *     setOption('a?.b', 456)
 *   ),
 *   0.none
 * )
 *
 * @since 1.0.7
 */

We should probably use docs-ts at some point to make sure that the examples actually compile

@ivklgn ivklgn mentioned this issue Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants