标签:instance head rom doc dev inter doctype cti src
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <script src="./page.ts"></script> </body> </html>
page.ts
import $ from ‘jquery‘; $(function () { $(‘body‘).html(‘<div>121212</div>‘); new $.fn.init() })
jquery.d.ts
// es6 模块化 declare module ‘jquery‘ { interface JqueryInstance { html: (html: string) => JqueryInstance } // 混合类型 function $(readyFunc: () => void): void; function $(selector: string): JqueryInstance; namespace $ { // $.fn.init namespace fn{ class init{} } } export = $; }
标签:instance head rom doc dev inter doctype cti src
原文地址:https://www.cnblogs.com/wzndkj/p/13205921.html