padStart
is defined in the ES2017
standard. You need to tell typescript to use the apropriate typings (the ones for ES2017
). You can do this either by setting the target to ES2017
, if your runtime supports all the language features required by ES2017
(which is probably not the case at the time of writing).
Another option is to just set the libs
option in order to get the typings for runtime objects in accordance with ES2017
but still compile down to whatever language version you are targeting.(Note that the runtime itself needs to support padStart
, typescript will not provide any poly-fills)
You can do this in tsconfig
using the lib
option:
"compilerOptions": {
"target": "es2016",
"lib": [
"es2017",
"dom"
"scripthost"
],
// ...
}
You can read more about lib vs target in this answer