but i want to do this typescript.How can i
Lucky for you TypeScript is a superset of JavaScript : https://basarat.gitbooks.io/typescript/content/docs/javascript/recap.html

So the code sample from https://stackoverflow.com/a/10524697/390330 works just fine
// for bootstrap 3 use 'shown.bs.tab', for bootstrap 2 use 'shown' in the next line
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
// save the latest tab; use cookies if you like 'em better:
localStorage.setItem('lastTab', $(this).attr('href'));
});
// go to the latest tab, if it exists:
var lastTab = localStorage.getItem('lastTab');
if (lastTab) {
$('[href="' + lastTab + '"]').tab('show');
}
NOTE: I didn't use the wrapping function as I hope you are using modules. More : https://basarat.gitbooks.io/typescript/content/docs/project/modules.html