[typeScript] js type derivation error

Version: 3.2.2
I have a person.js file and test.ts file, create a student class and person object in the js file, set student"s prototype to person, and then export an instance of student.
then accesses the instance of student in the test file, but ts does not have access to the properties on student"s prototype (that is, properties on person).

person.js

   

May.22,2022

you should set a Interface , such as

Interface Student {
    name:string
}

Typescrip Interface


you don't use the syntax of ts here at all.

you can write

as follows
   

there are still some problems with the limitations here. For example, the object returned by the prototype above does not actually contain the like field, but does not report an error.
so the above writing is still not recommended. It is recommended to operate fewer prototypes and use more ES6 syntax. There will be more support.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e40e94-448e4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e40e94-448e4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?