sinonjs / fake-timers

Fake setTimeout and friends (collectively known as "timers"). Useful in your JavaScript tests. Extracted from Sinon.JS
BSD 3-Clause "New" or "Revised" License
797 stars 104 forks source link

Make config properties optional in TypeScript defs #354

Closed geigerzaehler closed 3 years ago

geigerzaehler commented 3 years ago

Purpose (TL;DR)

We make the configuration argument for install and all configuration properties optional in the TypeScript definition. This fixes #352.

Background

As described in #352, the type definitions generated from the JSDoc comments required the config object with all parameters when calling install. All of these parameters are optional however.

Solution

It was necessary to create a JSDoc @typedef section because TypeScript is not able to generate the intended types from

@param [config.now] {number|Date}
codecov[bot] commented 3 years ago

Codecov Report

Merging #354 (2d4590a) into master (2df07dc) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #354   +/-   ##
=======================================
  Coverage   93.98%   93.98%           
=======================================
  Files           1        1           
  Lines         549      549           
=======================================
  Hits          516      516           
  Misses         33       33           
Flag Coverage Δ
unit 93.98% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/fake-timers-src.js 93.98% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2df07dc...2d4590a. Read the comment docs.

mroderick commented 3 years ago

This has been published to the npm registry as @sinonjs/fake-timers@7.0.2