import trim = require("trim"); var original: string = " padded string "; trim(original); trim.left(original); trim.right(original);