简体   繁体   English

TypeScript - 扩展标准lib Math的类型定义

[英]TypeScript - type definition for extended standard lib Math

I want to use the javascript library 我想使用javascript库

seedrandom.js seedrandom.js

in a TypeScript project yet can't figure out how to write a type definition for this lib which extends the standard javascript Math library with an additional method: 在一个TypeScript项目中,却无法弄清楚如何为这个lib编写一个类型定义,它使用另一种方法扩展了标准的javascript Math库:

Math.seedrandom();

Just add to the Math interface 只需添加到Math界面即可

interface Math {
    seedrandom(seed?: string);
}

Math.seedrandom();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM