Simple use jQuery with TypeScript (ok)

https://stackoverflow.com/questions/32050645/how-to-use-jquery-with-typescript

npm install --save-dev @types/jquery

C:\Users\Administrator\Desktop\gulp\es6.tsx

class Person {
  constructor(name: string) {
    this.name = name;
  }
  name: string;
}
function greeter(person: Person) {
  return "Hello " + person.name;
}
var person = new Person("Lionel");
$(document).ready(function() {
  var message = greeter(person);
  $("#status")[0].innerHTML = message;
});

C:\Users\Administrator\Desktop\gulp\index.html

<html>
<head>
   <script src="http://code.jquery.com/jquery-1.8.0.js"></script>
</head>
<body>
<script src="es6.js"></script>
<div id="status"></div>
</body>
</html>

Last updated

Navigation

Lionel

@Copyright 2023