[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: typescript [was: Re: How to write (existential) p
On Wed, Feb 13, 2019 at 4:38 PM Liam R. E. Quin liam@xxxxxxxxxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > [garbled gibberish here] > Sorry, that was I think the problem of mailer. > Ungarbling, i get, > class Student { > fullName: string; > constructor(public firstName: string, public middleInitial: string, > public lastName: string) { > this.fullName = firstName + " " + middleInitial + " " + lastName; > } > } > > interface Person { > firstName: string; > lastName: string; > } > > function greeter(person : Person) { > return "Hello, " + person.firstName + " " + person.lastName; > } > > let user = new Student("Jane", "M.", "User"); > > document.body.innerHTML = greeter(user); > > So you are asking, does a Student object confom to the Person > interface? That is, does the object have the required public fields. > We can see by inspection that it does.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|