fix typescript errors in node-red d.ts def files

This commit is contained in:
Steve-Mcl 2021-06-05 12:42:13 +01:00
parent db676ec223
commit 7f2c6e40d3
2 changed files with 24 additions and 18 deletions

View File

@ -1,15 +1,18 @@
/* NOTE: Do not edit directly! This file is generated using \`npm run update-types\` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */
interface NodeMessage {
topic?: string;
payload?: any;
_msgid?: string;
[other: any]: any; //permit other properties
[other: string]: any; //permit other properties
}
/** @type {NodeMessage} the `msg` object */
var msg: NodeMessage;
declare var msg: NodeMessage;
/** @type {string} the id of the incoming `msg` (alias of msg._msgid) */
const __msgid__:string;
declare const __msgid__:string;
/**
* @typedef NodeStatus
@ -46,11 +49,11 @@ declare class node {
* ```
* @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously)
*/
static send(msg:object, clone:Boolean=true);
static send(msg:object, clone?:Boolean);
/** Inform runtime this instance has completed its operation */
static done();
/** Send an error to the console and debug side bar. Include `msg` in the 2nd parameter to trigger the catch node. */
static error(err:string|Error, msg:object=null);
static error(err:string|Error, msg?:object);
/** Log a warn message to the console and debug sidebar */
static warn(warning:string|Object);
/** Log an info message to the console (not sent to sidebar)' */
@ -69,33 +72,33 @@ declare class node {
*/
static status(status:NodeStatus);
/** the id of this node */
public static readonly id:string;
public readonly id:string;
/** the name of this node */
public static readonly name:string;
public readonly name:string;
/** the number of outputs of this node */
public static readonly outputCount:Number;
public readonly outputCount:Number;
}
declare class context {
/** Get a value from context */
static get(name:string, store:string="default");
static get(name:string, store?:string);
/** Store a value in context */
static set(name:string, value:Any, store:string="default");
static set(name:string, value:any, store?:string);
/** Get an array of the keys in the context store */
static keys(store:string="default"):Array ;
static keys(store?:string):Array<string> ;
}
declare class flow {
/** Get a value from flow context */
static get(name:string, store:string="default");
static get(name:string, store?:string);
/** Store a value in flow context */
static set(name:string, value:Any, store:string="default");
static set(name:string, value:any, store?:string);
/** Get an array of the keys in the flow context store */
static keys(store:string="default"):Array ;
static keys(store?:string):Array<string> ;
}
declare class global {
/** Get a value from global context */
static get(name:string, store:string="default");
static get(name:string, store?:string);
/** Store a value in global context */
static set(name:string, value:Any, store:string="default");
static set(name:string, value:any, store?:string);
/** Get an array of the keys in the global context store */
static keys(store:string="default"):Array ;
static keys(store?:string):Array<string> ;
}

View File

@ -1,4 +1,7 @@
/* NOTE: Do not edit directly! This file is generated using \`npm run update-types\` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */
/*
How to generate...
1. Generate from packages\node_modules\@node-red\util\lib\util.js using `npx typescript` and a tsconfig.json of...
@ -22,7 +25,7 @@ declare namespace RED {
/**
* Utility functions for the node-red function sandbox
*/
declare namespace util {
namespace util {
/**
* Encode an object to JSON without losing information about non-JSON types