Files
DefinitelyTyped/types/ewma/ewma-tests.ts
Tristan F 1e9b0c1017 🤖 Merge PR #63012 Add new typings for ewma in NPM by @LeoDog896
* base ewma set

* Update types/ewma/index.d.ts

Remove UMD

Co-authored-by: Adam Thompson-Sharpe <adamthompsonsharpe@gmail.com>

Co-authored-by: Adam Thompson-Sharpe <adamthompsonsharpe@gmail.com>
2022-11-02 04:27:20 -07:00

36 lines
955 B
TypeScript

import EWMA = require("ewma");
const clock = {
now() {
return 4541;
}
};
// $ExpectType EwmaClass
const ewmaClass = new EWMA(1, 10, clock);
// $ExpectType EwmaClass
const ewmaFunction = EWMA(1, 10, clock);
// $ExpectType EwmaClass
const ewmaClassNoClock = new EWMA(1, 10);
// $ExpectType EwmaClass
const ewmaFunctionNoClick = EWMA(1, 10);
// $ExpectType EwmaClass
const ewmaClassDate = new EWMA(1, 10, Date);
// $ExpectType EwmaClass
const ewmaFunctionDate = EWMA(1, 10, Date);
// @ts-expect-error
const ewmaClassInvalidClock = new EWMA(1, 10, 5);
// @ts-expect-error
const ewmaFunctionInvalidClick = EWMA(1, 10, 55);
// @ts-expect-error
const ewmaClassInvalidParams = new EWMA(new Symbol(5), 1);
// @ts-expect-error
const ewmaClassInvalidParams2 = new EWMA(1, new Symbol(5));
// @ts-expect-error
const ewmaFunctionInvalidParams = EWMA(1, new Symbol(5));
// @ts-expect-error
const ewmaFunctionInvalidParams2 = EWMA(new Symbol(5), 1);