diff --git a/CHANGES.md b/CHANGES.md
index b5f7f6b497..d8cbfee4b4 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -13,6 +13,9 @@ Deprecations:
Language Improvements:
+- enh(typescript) add setInterval, setTimeout, clearInterval, clearTimeout (#2514) [Josh Goebel][]
+- enh(javascript) add setInterval, setTimeout, clearInterval, clearTimeout (#2514) [Vania Kucher][]
+- fix(javascript) prevent `set` keyword conflicting with setTimeout, etc. (#2514) [Vania Kucher][]
- fix(cpp) Fix highlighting of unterminated raw strings (#2261) [David Benjamin][]
- fix(javascript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
- fix(typescript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
@@ -21,6 +24,7 @@ Language Improvements:
[Josh Goebel]: https://github.com/yyyc514
[Peter Plantinga]: https://github.com/pplantinga
[David Benjamin]: https://github.com/davidben
+[Vania Kucher]: https://github.com/qWici
## Version 10.0.1
diff --git a/src/languages/javascript.js b/src/languages/javascript.js
index 0ad9b3f18f..eb0d62adc0 100644
--- a/src/languages/javascript.js
+++ b/src/languages/javascript.js
@@ -33,7 +33,7 @@ export default function(hljs) {
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' +
- 'Promise'
+ 'Promise setInterval setTimeout clearInterval clearTimeout'
};
var NUMBER = {
className: 'number',
@@ -263,7 +263,7 @@ export default function(hljs) {
beginKeywords: 'constructor', end: /\{/, excludeEnd: true
},
{
- begin:'(get|set)\\s*(?=' + IDENT_RE+ '\\()',
+ begin: '(get|set)\\s+(?=' + IDENT_RE + '\\()',
end: /{/,
keywords: "get set",
contains: [
diff --git a/src/languages/typescript.js b/src/languages/typescript.js
index 9266b55e6b..fd7f59ad7f 100644
--- a/src/languages/typescript.js
+++ b/src/languages/typescript.js
@@ -25,7 +25,8 @@ export default function(hljs) {
'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
- 'module console window document any number boolean string void Promise'
+ 'module console window document any number boolean string void Promise ' +
+ 'setInterval setTimeout clearInterval clearTimeout'
};
var DECORATOR = {
className: 'meta',
diff --git a/test/markup/javascript/keyword-as-part-of-method-name.expect.txt b/test/markup/javascript/keyword-as-part-of-method-name.expect.txt
new file mode 100644
index 0000000000..5a004f4fa0
--- /dev/null
+++ b/test/markup/javascript/keyword-as-part-of-method-name.expect.txt
@@ -0,0 +1,2 @@
+setTimeout();
+setInterval();
\ No newline at end of file
diff --git a/test/markup/javascript/keyword-as-part-of-method-name.txt b/test/markup/javascript/keyword-as-part-of-method-name.txt
new file mode 100644
index 0000000000..30d71a2e36
--- /dev/null
+++ b/test/markup/javascript/keyword-as-part-of-method-name.txt
@@ -0,0 +1,2 @@
+setTimeout();
+setInterval();
\ No newline at end of file