diff --git a/attw.json b/attw.json index db9056d26d0ea07..88acbe94283b286 100644 --- a/attw.json +++ b/attw.json @@ -221,7 +221,6 @@ "raphael", "rasa-webchat", "raygun4js", - "rc-switch", "react-add-to-calendar", "react-animals", "react-animate-on-scroll", diff --git a/notNeededPackages.json b/notNeededPackages.json index a1615d5137b17ec..59e4769c1f949f7 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1441,6 +1441,10 @@ "libraryName": "cypress-recurse", "asOfVersion": "1.9.0" }, + "cytoscape-popper": { + "libraryName": "cytoscape-popper", + "asOfVersion": "4.0.0" + }, "dargs": { "libraryName": "dargs", "asOfVersion": "6.1.0" @@ -3805,6 +3809,10 @@ "libraryName": "levenshtein-edit-distance", "asOfVersion": "3.0.0" }, + "libarchive.js": { + "libraryName": "libarchive.js", + "asOfVersion": "2.0.1" + }, "libra-core": { "libraryName": "libra-core", "asOfVersion": "1.0.5" @@ -5751,6 +5759,10 @@ "libraryName": "rc-steps", "asOfVersion": "4.0.0" }, + "rc-switch": { + "libraryName": "rc-switch", + "asOfVersion": "2.0.0" + }, "rc-time-picker": { "libraryName": "rc-time-picker", "asOfVersion": "3.5.0" @@ -6419,6 +6431,10 @@ "libraryName": "react-time-picker", "asOfVersion": "6.0.0" }, + "react-timeago": { + "libraryName": "react-timeago", + "asOfVersion": "8.0.0" + }, "react-toast-notifications": { "libraryName": "react-toast-notifications", "asOfVersion": "2.4.1" @@ -8051,6 +8067,10 @@ "libraryName": "wikidata-sdk", "asOfVersion": "6.1.0" }, + "windows-1251": { + "libraryName": "windows-1251", + "asOfVersion": "3.0.4" + }, "windows-foreground-love": { "libraryName": "windows-foreground-love", "asOfVersion": "0.3.1" diff --git a/types/cytoscape-popper/.eslintrc.json b/types/cytoscape-popper/.eslintrc.json deleted file mode 100644 index 79ee5b5a1a58368..000000000000000 --- a/types/cytoscape-popper/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "@definitelytyped/no-single-element-tuple-type": "off" - } -} diff --git a/types/cytoscape-popper/cytoscape-popper-tests.ts b/types/cytoscape-popper/cytoscape-popper-tests.ts deleted file mode 100644 index 53e6b4f4dc8464d..000000000000000 --- a/types/cytoscape-popper/cytoscape-popper-tests.ts +++ /dev/null @@ -1,55 +0,0 @@ -import cytoscape = require("cytoscape"); -import popper = require("cytoscape-popper"); - -cytoscape.use(popper); - -const cy = cytoscape({ - container: document.getElementById("cy"), - layout: { name: "breadthfirst" }, - elements: [ - { data: { id: "A" } }, - { data: { id: "B" } }, - { data: { id: "C" } }, - { data: { source: "A", target: "B" } }, - { data: { source: "A", target: "C" } }, - ], -}); - -cy.nodes().forEach(node => { - node.popper({ - content: () => { - const div = document.createElement("div"); - div.innerText = "DefinitelyTyped tests"; - document.body.appendChild(div); - - return div; - }, - renderedDimensions: el => { - return (el as cytoscape.NodeSingular).renderedBoundingBox({}); - }, - popper: { - strategy: "fixed", - placement: "bottom-end", - modifiers: [{ enabled: true }], - }, - }); -}); - -cy.popper({ - content: () => { - const div = document.createElement("div"); - div.innerText = "DefinitelyTyped tests"; - document.body.appendChild(div); - - return div; - }, - renderedPosition: el => { - return { x: 50, y: 50 }; - }, -}); - -const nodeRef = cy.nodes().first().popperRef(); -console.log(nodeRef); - -const coreRef = cy.popperRef(); -console.log(coreRef); diff --git a/types/cytoscape-popper/index.d.ts b/types/cytoscape-popper/index.d.ts deleted file mode 100644 index 78c0dbbedb62bfd..000000000000000 --- a/types/cytoscape-popper/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -import cy = require("cytoscape"); -import popper = require("@popperjs/core"); - -declare const cytoscapePopper: cy.Ext; -export = cytoscapePopper; -export as namespace cytoscapePopper; - -declare namespace cytoscapePopper { - interface Dimensions { - w: number; - h: number; - } - - interface Options { - /* - * The HTML content of the popper. May be a DOM Element reference or a function that returns one. - */ - content?: () => HTMLElement | HTMLElement | undefined; - /* - * A function that can be used to override the [rendered](http://js.cytoscape.org/#notation/position) Cytoscape position of the Popper target. - * This option is mandatory when using Popper on the core. - * For an element, the centre of its bounding box is used by default. - */ - renderedPosition?: ((el: Type) => cytoscape.Position) | undefined; - /* - * A function that can be used to override the [rendered](http://js.cytoscape.org/#notation/position) Cytoscape bounding box dimensions - * considered for the popper target (i.e. `cy` or `ele`). - * It defines only the effective `width` and `height` (`bb.w` and `bb.h`) of the Popper target. - * This option is more often useful for elements rather than for the core. - */ - renderedDimensions?: ((el: Type) => Dimensions) | undefined; - /* - * The [Popper options](https://popper.js.org/docs/v2/constructors/#options) object. - * You may use this to override Popper options. - */ - popper?: popper.Options | undefined; - } - - type getPopperInstance = (opts?: Options) => popper.Instance; - - type getPopperRef = (opts?: Options) => popper.VirtualElement; -} - -declare global { - namespace cytoscape { - interface SingularData { - /* - * Get a [Popper Instance](https://popper.js.org/docs/v2/constructors/) for the specified element. - */ - popper: cytoscapePopper.getPopperInstance; - /* - * Get a [Popper virtual element](https://popper.js.org/docs/v2/virtual-elements/) - * (aka Popper reference object in Popper v1) for the specified specified element. - */ - popperRef: cytoscapePopper.getPopperRef; - } - - interface Core { - /* - * Get a [Popper Instance](https://popper.js.org/docs/v2/constructors/) for the specified core Cytoscape instance. - */ - popper: cytoscapePopper.getPopperInstance; - /* - * Get a [Popper virtual element](https://popper.js.org/docs/v2/virtual-elements/) - * (aka Popper reference object in Popper v1) for the specified core Cytoscape instance. - */ - popperRef: cytoscapePopper.getPopperRef; - } - } -} diff --git a/types/cytoscape-popper/package.json b/types/cytoscape-popper/package.json deleted file mode 100644 index 4acf74a5a3beb44..000000000000000 --- a/types/cytoscape-popper/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "private": true, - "name": "@types/cytoscape-popper", - "version": "2.0.9999", - "projects": [ - "https://github.com/cytoscape/cytoscape.js-popper" - ], - "dependencies": { - "@popperjs/core": "^2.0.0", - "@types/cytoscape": "*" - }, - "devDependencies": { - "@types/cytoscape-popper": "workspace:." - }, - "owners": [ - { - "name": "Felix Barczewicz", - "githubUsername": "DieserFelix" - } - ] -} diff --git a/types/cytoscape-popper/tsconfig.json b/types/cytoscape-popper/tsconfig.json deleted file mode 100644 index 5ce909272999116..000000000000000 --- a/types/cytoscape-popper/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cytoscape-popper-tests.ts" - ] -} diff --git a/types/libarchive.js/.npmignore b/types/libarchive.js/.npmignore deleted file mode 100644 index 93e307400a5456b..000000000000000 --- a/types/libarchive.js/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/libarchive.js/index.d.ts b/types/libarchive.js/index.d.ts deleted file mode 100644 index d66d2cdb21db88e..000000000000000 --- a/types/libarchive.js/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./main"; diff --git a/types/libarchive.js/libarchive.js-tests.ts b/types/libarchive.js/libarchive.js-tests.ts deleted file mode 100644 index be9cbbfd0209997..000000000000000 --- a/types/libarchive.js/libarchive.js-tests.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Archive } from "libarchive.js/main"; - -let testFile: File = new File([""], "filename"); -const testArchive = new Archive(testFile, { workerUrl: "test" }); - -Archive.init({ workerUrl: "test" }); -Archive.open(testFile).then(e => void e); -Archive.open(testFile, { workerUrl: "test" }).then(e => void e); - -const FilesObject1: { [key: string]: any } = { - test2: testFile, -}; - -let FilesObject2: { [key: string]: any } = { - test2: FilesObject1, -}; - -let testArray: Array<{ file: any; path: string }> = []; - -testArchive.hasEncryptedData().then((res) => { - console.log(res); -}); -testArchive.usePassword("qwe").then(() => {}); -testArchive.getFilesObject().then((res) => { - FilesObject2 = res; -}); -testArchive.getFilesArray().then((res) => { - testArray = res; -}); -testArchive.extractFiles((entry) => { - testArray.push(entry); -}).then(() => {}); -testArchive.extractFiles().then((res) => { - FilesObject2 = res; -}); -testArchive.extractSingleFile("qwe").then((res) => { - testFile = res; -}); diff --git a/types/libarchive.js/main.d.ts b/types/libarchive.js/main.d.ts deleted file mode 100644 index e8e9ab4f4b8c3ae..000000000000000 --- a/types/libarchive.js/main.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { Archive } from "./src/libarchive"; diff --git a/types/libarchive.js/package.json b/types/libarchive.js/package.json deleted file mode 100644 index 76fa22f7cb6b222..000000000000000 --- a/types/libarchive.js/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "name": "@types/libarchive.js", - "version": "1.3.9999", - "projects": [ - "https://github.com/nika-begiashvili/libarchivejs" - ], - "devDependencies": { - "@types/libarchive.js": "workspace:." - }, - "owners": [ - { - "name": "Denis Malykh", - "githubUsername": "finesunes" - } - ] -} diff --git a/types/libarchive.js/src/compressed-file.d.ts b/types/libarchive.js/src/compressed-file.d.ts deleted file mode 100644 index 7c0474ebf5f1fa1..000000000000000 --- a/types/libarchive.js/src/compressed-file.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Archive } from "./libarchive"; - -export class CompressedFile { - _name: string; - _size: number; - _path: string; - _archiveRef: Archive; - - constructor(name: string, size: number, path: string, archiveRef: Archive); - - get name(): string; - - get size(): number; - - extract(): Promise; -} diff --git a/types/libarchive.js/src/libarchive.d.ts b/types/libarchive.js/src/libarchive.d.ts deleted file mode 100644 index 3e2a884fdaa7216..000000000000000 --- a/types/libarchive.js/src/libarchive.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { CompressedFile } from "./compressed-file"; - -export interface FilesObject { - [key: string]: FilesObject | CompressedFile | File; -} - -export class Archive { - static init(options?: { workerUrl: string }): { workerUrl: string }; - - static open(file: File, options?: { workerUrl: string }): Promise; - - constructor(file: File, options: { workerUrl: string }); - - open(): Promise; - - hasEncryptedData(): Promise; - - usePassword(archivePassword: string | number): Promise; - - getFilesObject(): Promise; - - getFilesArray(): Promise>; - - extractFiles(extractCallback?: (entry: { file: File; path: string }) => void): Promise; - - extractSingleFile(path: string): Promise; -} diff --git a/types/libarchive.js/tsconfig.json b/types/libarchive.js/tsconfig.json deleted file mode 100644 index 906aecf466f9809..000000000000000 --- a/types/libarchive.js/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "DOM" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "libarchive.js-tests.ts" - ] -} diff --git a/types/cytoscape-popper/.npmignore b/types/net-snmp/.npmignore similarity index 100% rename from types/cytoscape-popper/.npmignore rename to types/net-snmp/.npmignore diff --git a/types/net-snmp/index.d.ts b/types/net-snmp/index.d.ts new file mode 100644 index 000000000000000..587ced8f8a9d261 --- /dev/null +++ b/types/net-snmp/index.d.ts @@ -0,0 +1,748 @@ +/// +import { RemoteInfo } from "dgram"; + +export class Session { + constructor(target: string, authenticator: User, options: SessionOptionsV3); + constructor(target: string, authenticator: string, options: SessionOptions); + constructor(target: string, authenticator: undefined, options: SessionOptions); + + cancelRequests(error: any): void; + + close(): this; + + get(oids: string | string[], responseCb: GetSetCallback): Session; + + getBulk(oids: string[], nonRepeaters: number, maxRepetitions: number, responseCb: GetBulkCallback): this; + getBulk(oids: string[], nonRepeaters: number, responseCb: GetBulkCallback): this; + getBulk(oids: string[], responseCb: GetBulkCallback): this; + + getNext(oids: string[], responseCb: GetSetCallback): this; + + simpleGet( + pduClass: any, + feedCb: (req: Req, message: Message) => void, + varbinds: Varbind[], + responseCb: ResponseCallback, + options?: SimpleGetOptions, + ): void; + + inform(typeOrOid: string | number, varbinds: Varbind[], options: InformOptions, responseCb: ResponseCallback): this; + inform(typeOrOid: string | number, varbinds: Varbind[], responseCb: ResponseCallback): this; + inform(typeOrOid: string | number, options: InformOptions, responseCb: ResponseCallback): this; + inform(typeOrOid: string | number, responseCb: ResponseCallback): this; + onClose(): void; + + onError(error: any): void; + + onMsg(buffer: Buffer): void; + + onProxyResponse(req: Req, message: Message): void; + + onSimpleGetResponse(req: Req, message: Message): void; + + registerRequest(req: Req): void; + + send(req: Req, noWait: boolean): this; + + private sendV3Discovery( + originalPdu: any, + feedCb: (req: Req, message: Message) => void, + responseCb: (error: Error | null, result?: any) => void, + options?: RequestOptions, + ): void; + + private sendV3Req( + pdu: any, + feedCb: (req: Req, message: Message) => void, + responseCb: (error: Error | null, result?: any) => void, + options?: RequestOptions, + port?: number, + allowReport?: boolean, + ): void; + + set(varbinds: Varbind[], responseCb: GetSetCallback): this; + + subtree(oid: string, feedCb: FeedCallback, doneCb: DoneCallback): this; + subtree(oid: string, maxRepetitions: number, feedCb: FeedCallback, doneCb: DoneCallback): this; + + table(oid: string, responseCb: TableCallback): this; + table(oid: string, maxRepetitions: number, responseCb: TableCallback): this; + + tableColumns(oid: string, columns: string[], responseCb: TableColumnsCallback): this; + tableColumns(oid: string, columns: string[], maxRepetitions: number, responseCb: TableColumnsCallback): this; + + trap(typeOrOid: string | number, varbinds: Varbind[], options: TrapOptions, responseCb: TrapCallback): this; + trap(typeOrOid: string | number, varbinds: Varbind[], agentAddr: string, responseCb: TrapCallback): this; + trap(typeOrOid: string | number, varbinds: Varbind[], responseCb: TrapCallback): this; + trap(typeOrOid: string | number, agentAddr: string, responseCb: TrapCallback): this; + trap(typeOrOid: string | number, options: TrapOptions, responseCb: TrapCallback): this; + trap(typeOrOid: string | number, responseCb: TrapCallback): this; + + unregisterRequest(id: number): Req | null; + + userSecurityModelError(req: Req, oid: string): void; + + walk(oid: string, feedCb: FeedCallback, doneCb: DoneCallback): this; + walk(oid: string, maxRepetitions: number, feedCb: FeedCallback, doneCb: DoneCallback): this; + + static create(target: string, community: string, options: SessionOptions): Session; + + static createV3(target: string, user: User, options?: SessionOptionsV3): Session; + + on(event: "close", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "message", listener: (buffer: Buffer) => void): this; +} + +export type TableColumnsCallback = (error: Error | null, table?: TableColumnsData) => void; + +export interface TableData { + [columnName: string]: { // e.g., "ifDescr", "ifOperStatus" + [instanceNumber: number]: VarbindValue; + }; +} + +// tableColumns() returns complete table with column numbers as keys +export interface TableColumnsData { + [columnNumber: string]: { // e.g., "2", "7", "8" (column suffixes) + [instanceNumber: number]: VarbindValue; + }; +} + +export type TableCallback = (error: RequestFailedError | null, table?: TableData) => void; +export type TrapCallback = (error: Error | null) => void; + +export interface TrapOptions { + upTime?: number; + agentAddr?: string; + port?: number; +} + +export interface SessionOptions { + version?: 0 | 1; // Version1 | Version2c + transport?: "udp4" | "udp6"; + port?: number; + trapPort?: number; + retries?: number; + timeout?: number; + backoff?: number; + sourceAddress?: string; + sourcePort?: number; + idBitsSize?: number; + context?: string; + backwardsGetNexts?: boolean; + reportOidMismatchErrors?: boolean; + debug?: boolean; + dgramModule?: any; +} +export interface InformOptions extends RequestOptions { + upTime?: number; +} +export type ResponseCallback = (error: RequestInvalidError | ResponseInvalidError | null, varbinds?: Varbind[]) => void; +export type GetSetCallback = (error: ResponseInvalidError | null, varbinds?: Varbind[]) => void; + +export type GetBulkCallback = (error: ResponseInvalidError | null, varbinds?: (Varbind | Varbind[])[]) => void; + +interface Req { + message: Message; + responseCb: ResponseCallback; + retries: number; + timeout: number; + backoff: number; + onResponse: ResponseHandler; + feedCb: FeedHandler; + port: number; + context: string; + originalPdu?: any; + allowReport?: boolean; + timer?: NodeJS.Timeout; + id?: number | string; + proxiedRinfo?: RemoteInfo; + proxiedPduId?: number; + proxiedUser?: User; + proxiedEngine?: any; + proxiedSocket?: any; + + getId(): number | string; +} + +export type ResponseHandler = (req: Req, message: Message) => void; +export type FeedHandler = (req: Req, message: Message) => void; + +export interface ReqConstructor { + new( + session: Session, + message: Message, + feedCb: FeedHandler, + responseCb: ResponseCallback, + options?: RequestOptions, + ): Req; +} +export interface RequestOptions { + port?: number; + context?: string; + timeout?: number; + retries?: number; + backoff?: number; +} +export interface Message { + version: number; + community?: string; + pdu: any; + buffer?: Buffer; + msgGlobalData?: { + msgID: number; + msgMaxSize: number; + msgFlags: number; + msgSecurityModel: number; + }; + msgSecurityParameters?: { + msgAuthoritativeEngineID: Buffer; + msgAuthoritativeEngineBoots: number; + msgAuthoritativeEngineTime: number; + msgUserName: string; + msgAuthenticationParameters: Buffer; + msgPrivacyParameters: Buffer; + }; + user?: User; + encryptedPdu?: Buffer; + disableAuthentication?: boolean; + + // Methods + getReqId(): number; + toBuffer(): Buffer; + toBufferCommunity(): Buffer; + toBufferV3(): Buffer; + processIncomingSecurity(user: User, responseCb: (error: Error | null) => void): boolean; + decryptPdu(user: User, responseCb: (error: Error | null) => void): boolean; + checkAuthentication(user: User, responseCb: (error: Error | null) => void): boolean; + setMsgFlags(bitPosition: number, flag: boolean): void; + hasAuthentication(): boolean; + setAuthentication(flag: boolean): void; + hasPrivacy(): boolean; + setPrivacy(flag: boolean): void; + isReportable(): boolean; + setReportable(flag: boolean): void; + isAuthenticationDisabled(): boolean; + hasAuthoritativeEngineID(): boolean; + createReportResponseMessage(engine: any, context: string): Message; + createResponseForRequest(responsePdu: any): Message; + createCommunityResponseFromRequest(responsePdu: any): Message; + createV3ResponseFromRequest(responsePdu: any): Message; +} +// to do fix buffer types TODO + +interface MessageConstructor { + new(): Message; + + createCommunity(version: number, community: string, pdu: any): Message; + createRequestV3(user: User, msgSecurityParameters: any, pdu: any): Message; + createV3(user: User, msgGlobalData: any, msgSecurityParameters: any, pdu: any): Message; + createDiscoveryV3(pdu: any): Message; + createFromBuffer(buffer: Buffer, user?: User): Message; +} + +// Declare the Message constructor +declare const Message: MessageConstructor; + +export interface SimpleGetOptions extends RequestOptions { + nonRepeaters?: number; + maxRepetitions?: number; +} +export interface User { + name: string; + level: SecurityLevel; + authProtocol?: AuthProtocols; + authKey?: string; + privProtocol?: PrivProtocols; + privKey?: string; +} + +export interface SessionOptionsV3 { + version?: 3; + transport?: "udp4" | "udp6"; + port?: number; + trapPort?: number; + retries?: number; + timeout?: number; + backoff?: number; + sourceAddress?: string; + sourcePort?: number; + idBitsSize?: number; + context?: string; + backwardsGetNexts?: boolean; + reportOidMismatchErrors?: boolean; + engineID?: string | Buffer; + debug?: boolean; + dgramModule?: any; +} + +export type FeedCallback = ((varbinds: Varbind[]) => true) | ((varbinds: Varbind[]) => void); + +export type DoneCallback = (error: Error | null) => void; +export enum AccessControlModelType { + None, + Simple, +} + +export enum AccessLevel { + None, + ReadOnly, + ReadWrite, +} + +export enum AgentXPduType { + Open = 1, + Close, + Register, + Unregister, + Get, + GetNext, + GetBulk, + TestSet, + CommitSet, + UndoSet, + CleanupSet, + Notify, + Ping, + IndexAllocate, + IndexDeallocate, + AddAgentCaps, + RemoveAgentCaps, + Response, +} + +export enum AuthProtocols { + none = 1, + md5 = 2, + sha = 3, + sha224 = 4, + sha256 = 5, + sha384 = 6, + sha512 = 7, +} + +export enum ErrorStatus { + NoError, + TooBig, + NoSuchName, + BadValue, + ReadOnly, + GeneralError, + NoAccess, + WrongType, + WrongLength, + WrongEncoding, + WrongValue, + NoCreation, + InconsistentValue, + ResourceUnavailable, + CommitFailed, + UndoFailed, + AuthorizationError, + NotWritable, + InconsistentName, +} + +export enum MaxAccess { + "not-accessible", + "accessible-for-notify", + "read-only", + "read-write", + "read-create", +} + +export enum MibProviderType { + Scalar, + Table, +} +export enum ObjectType { + Boolean = 1, + Integer, + INTEGER = 2, + Integer32 = 2, + BitString, + OctetString, + "OCTET STRING" = 4, + Null, + OID, + "OBJECT IDENTIFIER" = 7, + IpAddress = 64, + Counter = 65, + Counter32 = Counter, + Gauge = 66, + Gauge32 = Gauge, + Unsigned32 = Gauge32, + TimeTicks = 67, + Opaque = 68, + Counter64 = 70, + NoSuchObject = 128, + NoSuchInstance = 129, + EndOfMibView = 130, +} + +export const OidFormat: { + module: string; + oid: string; + path: string; +}; + +export enum PduType { + GetRequest = 160, + GetNextRequest, + GetResponse, + SetRequest, + Trap, + GetBulkRequest, + InformRequest, + TrapV2, + Report, +} + +export enum PrivProtocols { + none = 1, + des = 2, + aes = 4, + aes256b = 6, + aes256r = 8, +} + +export enum ResponseInvalidCode { + EIp4AddressSize = 1, + EUnknownObjectType, + EUnknownPduType, + ECouldNotDecrypt, + EAuthFailure, + EReqResOidNoMatch, + EOutOfOrder = 8, + EVersionNoMatch, + ECommunityNoMatch, + EUnexpectedReport, + EResponseNotHandled, + EUnexpectedResponse, +} + +export enum RowStatus { + active = 1, + notInService, + notReady, + createAndGo, + createAndWait, + destroy, +} + +export enum SecurityLevel { + noAuthNoPriv = 1, + authNoPriv, + authPriv, +} + +export enum TrapType { + ColdStart, + WarmStart, + LinkDown, + LinkUp, + AuthenticationFailure, + EgpNeighborLoss, + EnterpriseSpecific, +} +export const Version1: 0; + +export const Version2c: 1; + +export const Version3: 3; + +export const Version: { + "1": typeof Version1; + "2c": typeof Version2c; + "3": typeof Version3; +}; + +export interface RequestFailedError extends Error { + name: "RequestFailedError"; + message: string; + status: ErrorStatus; +} + +export const RequestFailedError: { + new(message: string, status: ErrorStatus): RequestFailedError; + prototype: RequestFailedError; +}; + +export interface RequestTimedOutError extends Error { + name: "RequestTimedOutError"; +} + +export interface ResponseInvalidError extends Error { + name: "ResponseInvalidError"; + code: ResponseInvalidCode; + info?: any; +} + +export interface RequestInvalidError extends Error { + name: "RequestInvalidError"; +} + +export const ResponseInvalidError: { + new(message: string, code: ResponseInvalidCode, info?: any): ResponseInvalidError; + prototype: ResponseInvalidError; +}; +export function createAgent(options: any, callback: any, mib?: any): any; + +export function createMib(options?: MibOptions): any; +export interface MibOptions { + addScalarDefaultsOnRegistration?: boolean; +} + +export function createModuleStore(options?: ModuleStoreOptions): any; + +export interface ModuleStoreOptions { + baseModules?: string[]; +} + +export function createReceiver(options: any, callback: any): any; + +declare function createSession(target?: string, community?: string, options?: SessionOptions): Session; +declare namespace createSession { + const prototype: {}; +} + +export { createSession }; + +export function createSubagent(options: any): any; + +declare function createV3Session(target: string, user: User, options?: SessionOptionsV3): Session; + +declare namespace createV3Session { + const prototype: {}; +} + +export { createV3Session }; +export function isVarbindError(varbind: Varbind): boolean; + +export function varbindError(varbind: Varbind): string; + +export interface Varbind { + oid: string; + type?: ObjectType; + value?: VarbindValue; + errorStatus?: ErrorStatus; +} + +export type VarbindValue = + | string // ifDescr, ifAlias, sysDescr + | number // ifOperStatus, ifAdminStatus, ifIndex + | bigint // ifHCInOctets, ifHCOutOctets (64-bit counters) + | boolean // TruthValue + | Buffer // Raw data + | null // Missing values + | undefined; + +export namespace Authentication { + const HMAC_BUFFER_SIZE: number; + + const algorithms: { + readonly [AuthProtocols.none]: undefined; // none has no algorithm + readonly [AuthProtocols.md5]: { + KEY_LENGTH: 16; + AUTHENTICATION_CODE_LENGTH: 12; + CRYPTO_ALGORITHM: "md5"; + }; + readonly [AuthProtocols.sha]: { + KEY_LENGTH: 20; + AUTHENTICATION_CODE_LENGTH: 12; + CRYPTO_ALGORITHMF: "sha1"; + }; + readonly [AuthProtocols.sha224]: { + KEY_LENGTH: 28; + AUTHENTICATION_CODE_LENGTH: 16; + CRYPTO_ALGORITHM: "sha224"; + }; + readonly [AuthProtocols.sha256]: { + KEY_LENGTH: 32; + AUTHENTICATION_CODE_LENGTH: 24; + CRYPTO_ALGORITHM: "sha256"; + }; + readonly [AuthProtocols.sha384]: { + KEY_LENGTH: 48; + AUTHENTICATION_CODE_LENGTH: 32; + CRYPTO_ALGORITHM: "sha384"; + }; + readonly [AuthProtocols.sha512]: { + KEY_LENGTH: 64; + AUTHENTICATION_CODE_LENGTH: 48; + CRYPTO_ALGORITHM: "sha512"; + }; + }; + + const authToKeyCache: { + [key: string]: Buffer; + }; + + function calculateDigest( + messageBuffer: Buffer, + authProtocol: Exclude, + authPassword: string, + engineID: Buffer, + ): Buffer; + + function computeCacheKey(authProtocol: AuthProtocols, authPasswordString: string, engineID: Buffer): string; + + function getParametersLength(authProtocol: Exclude): number; + + function isAuthentic( + messageBuffer: Buffer, + authProtocol: AuthProtocols, + authPassword: string, + engineID: Buffer, + digestInMessage: Buffer, + ): boolean; + + function passwordToKey( + authProtocol: Exclude, + authPasswordString: string, + engineID: Buffer, + ): Buffer; + + function writeParameters( + messageBuffer: Buffer, + authProtocol: Exclude, + authPassword: string, + engineID: Buffer, + digestInMessage: Buffer, + ): void; +} + +export namespace Encryption { + const algorithms: { + readonly [PrivProtocols.des]: { + BLOCK_LENGTH: 8; + CRYPTO_ALGORITHM: "des-cbc"; + KEY_LENGTH: 8; + decryptPdu: typeof Encryption.decryptPduDes; + encryptPdu: typeof Encryption.encryptPduDes; + localizationAlgorithm: typeof Encryption.generateLocalizedKey; + }; + readonly [PrivProtocols.aes]: { + BLOCK_LENGTH: 16; + CRYPTO_ALGORITHM: "aes-128-cfb"; + KEY_LENGTH: 16; + decryptPdu: typeof Encryption.decryptPduAes; + encryptPdu: typeof Encryption.encryptPduAes; + localizationAlgorithm: typeof Encryption.generateLocalizedKey; + }; + readonly [PrivProtocols.aes256b]: { + BLOCK_LENGTH: 16; + CRYPTO_ALGORITHM: "aes-256-cfb"; + KEY_LENGTH: 32; + decryptPdu: typeof Encryption.decryptPduAes; + encryptPdu: typeof Encryption.encryptPduAes; + localizationAlgorithm: typeof Encryption.generateLocalizedKeyBlumenthal; + }; + readonly [PrivProtocols.aes256r]: { + BLOCK_LENGTH: 16; + CRYPTO_ALGORITHM: "aes-256-cfb"; + KEY_LENGTH: 32; + decryptPdu: typeof Encryption.decryptPduAes; + encryptPdu: typeof Encryption.encryptPduAes; + localizationAlgorithm: typeof Encryption.generateLocalizedKeyReeder; + }; + }; + + function decryptPduDes( + encryptedPdu: Buffer, + privProtocol: PrivProtocols, + privParameters: Buffer, + privPassword: string, + authProtocol: AuthProtocols, + engine: Algorithm, + ): Buffer; + + function encryptPduDes( + scopedPdu: Buffer, + privProtocol: PrivProtocols, + privPassword: string, + authProtocol: AuthProtocols, + engine: Algorithm, + ): { encryptedPdu: Buffer; msgPrivacyParameters: Buffer }; + + function decryptPduAes( + encryptedPdu: Buffer, + privProtocol: PrivProtocols, + privParameters: Buffer, + privPassword: string, + authProtocol: AuthProtocols, + engine: Algorithm, + ): Buffer; + + function encryptPduAes( + scopedPdu: Buffer, + privProtocol: PrivProtocols, + privPassword: string, + authProtocol: AuthProtocols, + engine: Algorithm, + ): { encryptedPdu: Buffer; msgPrivacyParameters: Buffer }; + + function generateLocalizedKey( + algorithm: Algorithm, + authProtocol: AuthProtocols, + privPassword: string, + engineID: Buffer, + ): Buffer; + + function generateLocalizedKeyBlumenthal( + algorithm: Algorithm, + authProtocol: AuthProtocols, + privPassword: string, + engineID: Buffer, + ): Buffer; + + function generateLocalizedKeyReeder( + algorithm: Algorithm, + authProtocol: AuthProtocols, + privPassword: string, + engineID: Buffer, + ): Buffer; +} +interface Algorithm { + readonly BLOCK_LENGTH: number; + readonly CRYPTO_ALGORITHM: string; + readonly KEY_LENGTH: number; + readonly decryptPdu: typeof Encryption.decryptPduAes; + readonly encryptPdu: typeof Encryption.encryptPduAes; + readonly localizationAlgorithm: typeof Encryption.generateLocalizedKey; +} + +// module asn1-ber doesn't have type support so we to create completing type for the buffer used in Object Parser +declare class BerReader { + readInt(): number; + readString(type?: number, explicit?: boolean): string | Buffer; + readBoolean(): boolean; + readBitString(): string; + readOID(): string; + readByte(): number; + readSequence(): number; + peek(): number | null; + readBuffer(type: number, explicit?: boolean): Buffer; + readLength(): number; +} + +export namespace ObjectParser { + function readInt32(buffer: BerReader): number; + + function readUint32(buffer: BerReader): number; + + function readUint64(buffer: BerReader): bigint | string; +} + +export namespace ObjectTypeUtil { + function castSetValue(type: any, value: any, constraints: any): any; + + function doesIntegerMeetConstraints(value: any, constraints: any): boolean; + + function doesStringMeetConstraints(value: any, constraints: any): boolean; + + function getEnumerationNumberFromName(enumeration: any, name: any): any; + + function isValid(type: ObjectType, value: any, constraints: any): boolean; +} diff --git a/types/net-snmp/net-snmp-tests.ts b/types/net-snmp/net-snmp-tests.ts new file mode 100644 index 000000000000000..659953e3b49da37 --- /dev/null +++ b/types/net-snmp/net-snmp-tests.ts @@ -0,0 +1,294 @@ +import { + AccessControlModelType, + AccessLevel, + AgentXPduType, + Authentication, + AuthProtocols, + createAgent, + createMib, + createReceiver, + createSession, + createSubagent, + createV3Session, + Encryption, + ErrorStatus, + isVarbindError, + MaxAccess, + MibProviderType, + ObjectParser, + ObjectType, + ObjectTypeUtil, + OidFormat, + PduType, + PrivProtocols, + RequestFailedError, + ResponseInvalidError, + RowStatus, + SecurityLevel, + TrapType, + Varbind, + varbindError, + Version, + Version1, + Version2c, + Version3, +} from "net-snmp"; + +// Basic successful cases +const V3Session1 = createV3Session("127.0.0.1", { + name: "testuser", + level: SecurityLevel.authPriv, + authProtocol: AuthProtocols.sha, + authKey: "authkey123", + privProtocol: PrivProtocols.aes, + privKey: "privkey123", +}); + +const V3Session2 = createV3Session("localhost", { + name: "testuser2", + level: SecurityLevel.noAuthNoPriv, +}); + +// With options +const V3Session3 = createV3Session( + "192.168.1.1", + { + name: "testuser3", + level: SecurityLevel.authNoPriv, + authProtocol: AuthProtocols.md5, + authKey: "authkey456", + }, + { + port: 1610, + timeout: 3000, + retries: 2, + }, +); + +// Should error cases +// @ts-expect-error - missing required user properties +const sessionError1 = createV3Session("127.0.0.1", {}); + +const sessionError2 = createV3Session( + "127.0.0.1", + { + name: "testuser", + level: SecurityLevel.authPriv, + }, + // @ts-expect-error - invalid version in options + { version: 2 }, +); + +const sessionError3 = createV3Session( + "127.0.0.1", + { + name: "testuser", + level: SecurityLevel.authPriv, + }, + // @ts-expect-error - invalid transport + { transport: "tcp" }, +); + +const sessionError4 = createV3Session("127.0.0.1", { + name: "testuser", + level: SecurityLevel.authPriv, + // @ts-expect-error - invalid auth protocol + authProtocol: "invalid-protocol", +}); + +// Test that returned session has expected methods +V3Session1.get("1.3.6.1.2.1.1.1.0", (_error: ResponseInvalidError | null, _varbinds?: Varbind[]) => {}); +V3Session1.getBulk( + ["1.3.6.1.2.1.1.1.0"], + 0, + 10, + (_error: ResponseInvalidError | null, _varbinds?: (Varbind | Varbind[])[]) => {}, +); +V3Session1.getBulk( + ["1.3.6.1.2.1.1.1.0"], + // @ts-expect-error - invalid order + (_error: ResponseInvalidError | null, _varbinds?: (Varbind | Varbind[])[]) => {}, + 10, +); +V3Session1.getNext(["1.3.6.1.2.1.1.1.0"], (_error: ResponseInvalidError | null, _varbinds?: Varbind[]) => {}); +V3Session2.close(); +V3Session3.set( + [ + { + oid: "1.3.6.1.2.1.1.5.0", + type: ObjectType.OctetString, + value: "test", + }, + ], + (_error: any, _varbinds?: Varbind[]) => {}, +); + +// Minimal valid call - all optional parameters omitted +const session1 = createSession(); + +// Only target provided +const session2 = createSession("127.0.0.1"); + +// Target and community provided +const session3 = createSession("127.0.0.1", "public"); + +// All parameters provided +const session4 = createSession("localhost", "private", { + version: 1, // Version2c + timeout: 2000, +}); + +// Invalid cases +// @ts-expect-error - invalid version (must be 0 or 1) +createSession(undefined, undefined, { version: 3 }); + +// @ts-expect-error - invalid transport type +createSession(undefined, undefined, { transport: "tcp" }); + +// @ts-expect-error - community must be string if provided +createSession("127.0.0.1", 12345); + +// Verify returned Session type has expected methods +session1.get("1.3.6.1.2.1.1.1.0", (_error: any, _varbinds?: Varbind[]) => {}); +session4.close(); + +// Additional tests for higher coverage + +// Test Varbind validation +const validVarbind: Varbind = { + oid: "1.3.6.1.2.1.1.1.0", + type: ObjectType.OctetString, + value: "test value", +}; + +// @ts-expect-error - missing required oid +const invalidVarbind1: Varbind = { + type: ObjectType.OctetString, + value: "test value", +}; + +const invalidVarbind2: Varbind = { + // @ts-expect-error - wrong OID type + oid: 12345, + type: ObjectType.OctetString, + value: "test value", +}; + +// Test varbind utility functions +const isError = isVarbindError(validVarbind); +const errorMsg = varbindError(validVarbind); + +// Test Authentication namespace +const authDigest = Authentication.calculateDigest( + Buffer.from("test"), + AuthProtocols.sha, + "password", + Buffer.from("engine123"), +); + +const authKey = Authentication.passwordToKey(AuthProtocols.sha, "password", Buffer.from("engine123")); + +// Test Encryption namespace +const encryptedData = Encryption.encryptPduAes( + Buffer.from("test"), + PrivProtocols.aes, + "privpassword", + AuthProtocols.sha, + Encryption.algorithms[PrivProtocols.aes], +); + +// Test ObjectTypeUtil namespace +const isValid = ObjectTypeUtil.isValid(ObjectType.OctetString, "test", {}); +const castValue = ObjectTypeUtil.castSetValue(ObjectType.Integer, "123", {}); + +// Test enum values +const pduType: PduType = PduType.GetRequest; +const errorStatus: ErrorStatus = ErrorStatus.NoError; +const trapType: TrapType = TrapType.ColdStart; +const rowStatus: RowStatus = RowStatus.active; +const maxAccess: MaxAccess = MaxAccess["read-only"]; +const agentXPduType: AgentXPduType = AgentXPduType.Open; +const accessControlModel: AccessControlModelType = AccessControlModelType.Simple; +const accessLevel: AccessLevel = AccessLevel.ReadOnly; +const mibProviderType: MibProviderType = MibProviderType.Scalar; + +// Test version constants +const version1: 0 = Version1; +const version2c: 1 = Version2c; +const version3: 3 = Version3; +const versionObj = Version["2c"]; + +// Test OidFormat +const oidFormat = OidFormat; + +// Test error classes +const requestFailedError = new RequestFailedError("Test error", ErrorStatus.TooBig); +const responseInvalidError = new ResponseInvalidError("Test error", 1, { additional: "info" }); + +// Test other creation functions +const agent = createAgent({}, () => {}); +const mib = createMib(); +const receiver = createReceiver({}, () => {}); +const subagent = createSubagent({}); + +// Test session event handlers +session1.on("close", () => {}); +session1.on("error", (_err: Error) => {}); +session1.on("message", (_buffer: Buffer) => {}); + +// Test invalid callback signatures +// @ts-expect-error - wrong callback signature for get +session1.get("1.3.6.1.2.1.1.1.0", (_error: string) => {}); + +// @ts-expect-error - wrong callback signature for set +session1.set([{ oid: "1.3.6.1.2.1.1.1.0", value: "test" }], (_error: string, _result: number) => {}); + +// Test invalid options for createSession +// @ts-expect-error - invalid option +createSession("127.0.0.1", "public", { invalidOption: true }); + +// Test invalid options for createV3Session +// @ts-expect-error - invalid option +createV3Session("127.0.0.1", { name: "test", level: SecurityLevel.noAuthNoPriv }, { invalidOption: true }); + +session3.walk( + "1.3.6.1.2.1.1", + (varbinds) => { + console.log(varbinds); + return false; // continue walking + }, + (error) => { + if (error) console.error(error); + }, +); + +// Test all overloads +V3Session1.table("1.3.6.1.2.1.1", (_error, _table) => {}); + +V3Session1.table("1.3.6.1.2.1.1", 50, (_error, _table) => {}); + +// Invalid cases +// @ts-expect-error - missing callback +V3Session1.table("1.3.6.1.2.1.1"); + +// @ts-expect-error - invalid maxRepetitions type +V3Session1.table("1.3.6.1.2.1.1", "invalid", (_error, _table) => {}); + +V3Session1.subtree( + "1.3.6.1.2.1.1", + (_varbinds) => {}, + (_error) => {}, +); +V3Session1.subtree( + "1.3.6.1.2.1.1", + 30, + (_varbinds) => {}, + (_error) => {}, +); + +// Invalid cases +// @ts-expect-error - missing done callback +V3Session1.subtree("1.3.6.1.2.1.1", (_varbinds) => {}); + +// @ts-expect-error - missing feed callback +V3Session1.subtree("1.3.6.1.2.1.1", (_error) => {}); diff --git a/types/net-snmp/package.json b/types/net-snmp/package.json new file mode 100644 index 000000000000000..f753f364f4f9b48 --- /dev/null +++ b/types/net-snmp/package.json @@ -0,0 +1,20 @@ +{ + "private": true, + "name": "@types/net-snmp", + "version": "3.23.9999", + "projects": [ + "https://github.com/markabrahams/node-net-snmp#readme" + ], + "devDependencies": { + "@types/net-snmp": "workspace:." + }, + "dependencies": { + "@types/node": "^24.3.0" + }, + "owners": [ + { + "name": "Ori Erel", + "githubUsername": "0rierel" + } + ] +} diff --git a/types/windows-1251/tsconfig.json b/types/net-snmp/tsconfig.json similarity index 92% rename from types/windows-1251/tsconfig.json rename to types/net-snmp/tsconfig.json index 4f11991be92fd26..3bd29be26fed8da 100644 --- a/types/windows-1251/tsconfig.json +++ b/types/net-snmp/tsconfig.json @@ -6,14 +6,14 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, "strictFunctionTypes": true, + "strictNullChecks": true, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "windows-1251-tests.ts" + "net-snmp-tests.ts" ] } diff --git a/types/rc-switch/.npmignore b/types/rc-switch/.npmignore deleted file mode 100644 index 93e307400a5456b..000000000000000 --- a/types/rc-switch/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/rc-switch/index.d.ts b/types/rc-switch/index.d.ts deleted file mode 100644 index e7cc7ad218fcc03..000000000000000 --- a/types/rc-switch/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import * as React from "react"; - -export interface Props { - autoFocus?: boolean | undefined; - checked?: boolean | undefined; - checkedChildren?: React.ReactNode | undefined; - className?: string | undefined; - defaultChecked?: boolean | undefined; - disabled?: boolean | undefined; - loadingIcon?: React.ReactNode | undefined; - onChange?: ((checked: boolean) => void) | undefined; - onClick?: ((checked: boolean) => void) | undefined; - prefixCls?: string | undefined; - tabIndex?: number | undefined; - unCheckedChildren?: React.ReactNode | undefined; -} - -export default class Switch extends React.Component {} diff --git a/types/rc-switch/package.json b/types/rc-switch/package.json deleted file mode 100644 index 86bdc5627b17a48..000000000000000 --- a/types/rc-switch/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "private": true, - "name": "@types/rc-switch", - "version": "1.9.9999", - "projects": [ - "https://github.com/react-component/switch" - ], - "dependencies": { - "@types/react": "*" - }, - "devDependencies": { - "@types/rc-switch": "workspace:.", - "@types/react-dom": "*" - }, - "owners": [ - { - "name": "Karol Majewski", - "githubUsername": "karol-majewski" - }, - { - "name": "Matteo Frana", - "githubUsername": "matteofrana" - } - ] -} diff --git a/types/rc-switch/rc-switch-tests.ts b/types/rc-switch/rc-switch-tests.ts deleted file mode 100644 index 843050e40c971b6..000000000000000 --- a/types/rc-switch/rc-switch-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ -import Switch, { Props } from "rc-switch"; -import * as React from "react"; -import * as ReactDOM from "react-dom"; - -/** - * Only required props (none) - */ -React.createElement(Switch); - -/** - * All accepted props - */ -React.createElement(Switch, { - autoFocus: false, - checked: false, - checkedChildren: "hello", - className: "switch", - defaultChecked: false, - disabled: false, - loadingIcon: 0, - onChange: console.log, - onClick: console.log, - prefixCls: "rc-", - tabIndex: 0, - unCheckedChildren: "world", -}); diff --git a/types/rc-switch/tsconfig.json b/types/rc-switch/tsconfig.json deleted file mode 100644 index 0f03fd372790272..000000000000000 --- a/types/rc-switch/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "strictFunctionTypes": true - }, - "files": [ - "index.d.ts", - "rc-switch-tests.ts" - ] -} diff --git a/types/react-timeago/.npmignore b/types/react-timeago/.npmignore deleted file mode 100644 index 93e307400a5456b..000000000000000 --- a/types/react-timeago/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/react-timeago/index.d.ts b/types/react-timeago/index.d.ts deleted file mode 100644 index 25388d2423dddb7..000000000000000 --- a/types/react-timeago/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import * as React from "react"; - -declare namespace ReactTimeago { - type Unit = - | "second" - | "minute" - | "hour" - | "day" - | "week" - | "month" - | "year"; - - type Suffix = "ago" | "from now"; - - type Formatter = ( - value: number, - unit: Unit, - suffix: Suffix, - epochMiliseconds: number, - nextFormatter?: Formatter, - ) => React.ReactNode; - - interface ReactTimeagoProps { - readonly live?: boolean | undefined; - readonly minPeriod?: number | undefined; - readonly maxPeriod?: number | undefined; - readonly component?: T | undefined; - readonly title?: string | undefined; - readonly formatter?: Formatter | undefined; - readonly date: string | number | Date; - readonly now?: (() => number) | undefined; - } -} - -declare class ReactTimeago< - T extends React.ElementType

, - P = React.ComponentProps, -> extends React.Component< - ReactTimeago.ReactTimeagoProps & P -> {} - -export = ReactTimeago; diff --git a/types/react-timeago/package.json b/types/react-timeago/package.json deleted file mode 100644 index fa724eab022d618..000000000000000 --- a/types/react-timeago/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "private": true, - "name": "@types/react-timeago", - "version": "4.1.9999", - "projects": [ - "https://github.com/nmn/react-timeago" - ], - "dependencies": { - "@types/react": "*" - }, - "devDependencies": { - "@types/react-timeago": "workspace:." - }, - "owners": [ - { - "name": "Konstantin Lebedev", - "githubUsername": "koss-lebedev" - }, - { - "name": "Mike Martin", - "githubUsername": "mcmar" - } - ] -} diff --git a/types/react-timeago/react-timeago-tests.tsx b/types/react-timeago/react-timeago-tests.tsx deleted file mode 100644 index 702829be6f30301..000000000000000 --- a/types/react-timeago/react-timeago-tests.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import * as React from "react"; -import ReactTimeago, { Suffix, Unit } from "react-timeago"; - -const ReactTimeagoRequiredOptions: React.JSX.Element = ; - -const customFormatter = ( - value: number, - unit: Unit, - suffix: Suffix, - epochMiliseconds: number, -) => { - return epochMiliseconds > 300000 - ? `${value}${unit[0]} ${suffix}` - : "a really long time ago"; -}; - -const ReactTimeagoAllOptions: React.JSX.Element = ( -

} - title="Timeago" - formatter={customFormatter} - /> -); - -const ReactTimeagoDefaultComponentProps: React.JSX.Element = ( - // Note that the default component is