diff --git a/src/parser/parsedHedSubstring.d.ts b/src/parser/parsedHedSubstring.d.ts new file mode 100644 index 00000000..d11152cf --- /dev/null +++ b/src/parser/parsedHedSubstring.d.ts @@ -0,0 +1,40 @@ +declare abstract class ParsedHedSubstring { + /** + * The original pre-parsed version of the HED tag. + */ + originalTag: string + /** + * The bounds of the HED tag in the original HED string. + */ + originalBounds: number[] + + /** + * Constructor. + * @param originalTag The original HED tag. + * @param originalBounds The bounds of the HED tag in the original HED string. + */ + protected constructor(originalTag: string, originalBounds: number[]) + + /** + * Nicely format this substring. This is left blank for the subclasses to override. + * + * This is left blank for the subclasses to override. + * + * @param long Whether the tags should be in long form. + */ + public abstract format(long: boolean): string + + /** + * Get the normalized version of the object. + */ + public abstract get normalized(): string + + /** + * Override of {@link Object.prototype.toString}. + * + * @returns The original form of this HED substring. + */ + public toString(): string +} + +export = ParsedHedSubstring diff --git a/src/parser/parsedHedSubstring.js b/src/parser/parsedHedSubstring.js index 27ea6a4b..46136ef8 100644 --- a/src/parser/parsedHedSubstring.js +++ b/src/parser/parsedHedSubstring.js @@ -2,53 +2,11 @@ * A parsed HED substring. */ export class ParsedHedSubstring { - /** - * The original pre-parsed version of the HED tag. - * @type {string} - */ - originalTag - /** - * The bounds of the HED tag in the original HED string. - * @type {int[]} - */ - originalBounds - - /** - * Constructor. - * @param {string} originalTag The original HED tag. - * @param {number[]} originalBounds The bounds of the HED tag in the original HED string. - */ constructor(originalTag, originalBounds) { this.originalTag = originalTag this.originalBounds = originalBounds } - /** - * Nicely format this substring. This is left blank for the subclasses to override. - * - * This is left blank for the subclasses to override. - * - * @param {boolean} long - Whether the tags should be in long form. - * @returns {string} - * @abstract - */ - format(long = true) {} - - /** - * Get the normalized version of the object. - * - * @returns {string} - * @abstract - */ - get normalized() { - return '' - } - - /** - * Override of {@link Object.prototype.toString}. - * - * @returns {string} The original form of this HED substring. - */ toString() { return this.originalTag }