diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 0052b8256e..61fd375e6f 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -68,6 +68,14 @@ interface SymbolConstructor { } declare var Symbol: SymbolConstructor; +// Node.js ESNEXT support +interface String { + /** Removes whitespace from the left end of a string. */ + trimLeft(): string; + /** Removes whitespace from the right end of a string. */ + trimRight(): string; +} + /************************************************ * * * GLOBAL * diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 41639e52c6..d85a2574db 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -3751,3 +3751,13 @@ namespace module_tests { const m1: Module = new Module("moduleId"); const m2: Module = new Module.Module("moduleId"); } + +//////////////////////////////////////////////////// +/// Node.js ESNEXT Support +//////////////////////////////////////////////////// + +namespace esnext_string_tests { + const s: string = 'foo'; + const s1: string = s.trimLeft(); + const s2: string = s.trimRight(); +}