小程序typescript模板编译出现错误

解决方法

更新最新版的开发工具,重新新建模板

简单分析

旧版本的typescript模板会缺少一些文件,导致TS编译的时候缺少文件

出错问题

miniprogram/app.ts:8:5 - error TS2558: Expected 0 type arguments, but got 1.

8 App<IMyApp>({
      ~~~~~~

miniprogram/typings/wx.d.ts:119:12 - error TS7006: Parameter 'a' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
               ~

miniprogram/typings/wx.d.ts:119:15 - error TS7006: Parameter 'b' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                  ~

miniprogram/typings/wx.d.ts:119:18 - error TS7006: Parameter 'c' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                     ~

miniprogram/typings/wx.d.ts:119:21 - error TS7006: Parameter 'd' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                        ~

miniprogram/typings/wx.d.ts:119:24 - error TS7006: Parameter 'tx' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                           ~~

miniprogram/typings/wx.d.ts:119:28 - error TS7006: Parameter 'ty' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                               ~~

miniprogram/typings/wx.d.ts:343:13 - error TS2451: Cannot redeclare block-scoped variable 'App'.

343 declare var App: AppConstructor;
                ~~~

  typings/wx/lib.wx.app.d.ts:11:19
    11 declare namespace App {
                         ~~~
    'App' was also declared here.
  typings/wx/lib.wx.app.d.ts:248:15
    248 declare const App: App.AppConstructor
                      ~~~
    and here.

miniprogram/typings/wx.d.ts:344:18 - error TS2451: Cannot redeclare block-scoped variable 'getApp'.

344 declare function getApp(): Application;
                     ~~~~~~

  typings/wx/lib.wx.app.d.ts:249:15
    249 declare const getApp: App.GetApp
                      ~~~~~~
    'getApp' was also declared here.

miniprogram/typings/wx.d.ts:346:18 - error TS2451: Cannot redeclare block-scoped variable 'getCurrentPages'.

346 declare function getCurrentPages(): Page[];
                     ~~~~~~~~~~~~~~~

  typings/wx/lib.wx.page.d.ts:181:15
    181 declare const getCurrentPages: Page.GetCurrentPages
                      ~~~~~~~~~~~~~~~
    'getCurrentPages' was also declared here.

miniprogram/typings/wx.d.ts:348:11 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

348 interface Page {
              ~~~~

  typings/wx/lib.wx.page.d.ts:11:19
    11 declare namespace Page {
                         ~~~~
    'Page' was also declared here.
  typings/wx/lib.wx.page.d.ts:180:15
    180 declare const Page: Page.PageConstructor
                      ~~~~
    and here.

miniprogram/typings/wx.d.ts:409:13 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

409 declare var Page: PageConstructor;
                ~~~~

  typings/wx/lib.wx.page.d.ts:11:19
    11 declare namespace Page {
                         ~~~~
    'Page' was also declared here.
  typings/wx/lib.wx.page.d.ts:180:15
    180 declare const Page: Page.PageConstructor
                      ~~~~
    and here.

miniprogram/typings/wx.d.ts:411:13 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

411 declare var wx: {
                ~~

  typings/wx/lib.wx.api.d.ts:11:19
    11 declare namespace wx {
                         ~~
    'wx' was also declared here.
  typings/wx/lib.wx.api.d.ts:12756:15
    12756 declare const wx: wx.Wx;
                        ~~
    and here.

typings/wx/lib.wx.api.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

11 declare namespace wx {
                     ~~

  miniprogram/typings/wx.d.ts:411:13
    411 declare var wx: {
                    ~~
    'wx' was also declared here.

typings/wx/lib.wx.api.d.ts:12756:15 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

12756 declare const wx: wx.Wx;
                    ~~

  miniprogram/typings/wx.d.ts:411:13
    411 declare var wx: {
                    ~~
    'wx' was also declared here.

typings/wx/lib.wx.api.d.ts:12756:22 - error TS2694: Namespace 'wx' has no exported member 'Wx'.

12756 declare const wx: wx.Wx;
                           ~~

typings/wx/lib.wx.app.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'App'.

11 declare namespace App {
                     ~~~

  miniprogram/typings/wx.d.ts:343:13
    343 declare var App: AppConstructor;
                    ~~~
    'App' was also declared here.

typings/wx/lib.wx.app.d.ts:248:15 - error TS2451: Cannot redeclare block-scoped variable 'App'.

248 declare const App: App.AppConstructor
                  ~~~

  miniprogram/typings/wx.d.ts:343:13
    343 declare var App: AppConstructor;
                    ~~~
    'App' was also declared here.

typings/wx/lib.wx.app.d.ts:248:20 - error TS2503: Cannot find namespace 'App'.

248 declare const App: App.AppConstructor
                       ~~~

typings/wx/lib.wx.app.d.ts:249:15 - error TS2451: Cannot redeclare block-scoped variable 'getApp'.

249 declare const getApp: App.GetApp
                  ~~~~~~

  miniprogram/typings/wx.d.ts:344:18
    344 declare function getApp(): Application;
                         ~~~~~~
    'getApp' was also declared here.

typings/wx/lib.wx.app.d.ts:249:23 - error TS2503: Cannot find namespace 'App'.

249 declare const getApp: App.GetApp
                          ~~~

typings/wx/lib.wx.page.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

11 declare namespace Page {
                     ~~~~

  miniprogram/typings/wx.d.ts:348:11
    348 interface Page {
                  ~~~~
    'Page' was also declared here.
  miniprogram/typings/wx.d.ts:409:13
    409 declare var Page: PageConstructor;
                    ~~~~
    and here.

typings/wx/lib.wx.page.d.ts:180:15 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

180 declare const Page: Page.PageConstructor
                  ~~~~

  miniprogram/typings/wx.d.ts:348:11
    348 interface Page {
                  ~~~~
    'Page' was also declared here.
  miniprogram/typings/wx.d.ts:409:13
    409 declare var Page: PageConstructor;
                    ~~~~
    and here.

typings/wx/lib.wx.page.d.ts:180:21 - error TS2702: 'Page' only refers to a type, but is being used as a namespace here.

180 declare const Page: Page.PageConstructor
                        ~~~~

typings/wx/lib.wx.page.d.ts:181:15 - error TS2451: Cannot redeclare block-scoped variable 'getCurrentPages'.

181 declare const getCurrentPages: Page.GetCurrentPages
                  ~~~~~~~~~~~~~~~

  miniprogram/typings/wx.d.ts:346:18
    346 declare function getCurrentPages(): Page[];
                         ~~~~~~~~~~~~~~~
    'getCurrentPages' was also declared here.

typings/wx/lib.wx.page.d.ts:181:32 - error TS2702: 'Page' only refers to a type, but is being used as a namespace here.

181 declare const getCurrentPages: Page.GetCurrentPages
                                   ~~~~


Found 26 errors.


F:\html\es6>node ./node_modules/typescript/lib/tsc.js
miniprogram/typings/wx.d.ts:119:12 - error TS7006: Parameter 'a' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
               ~

miniprogram/typings/wx.d.ts:119:15 - error TS7006: Parameter 'b' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                  ~

miniprogram/typings/wx.d.ts:119:18 - error TS7006: Parameter 'c' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                     ~

miniprogram/typings/wx.d.ts:119:21 - error TS7006: Parameter 'd' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                        ~

miniprogram/typings/wx.d.ts:119:24 - error TS7006: Parameter 'tx' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                           ~~

miniprogram/typings/wx.d.ts:119:28 - error TS7006: Parameter 'ty' implicitly has an 'any' type.

119     matrix(a, b, c, d, tx, ty): IAnimation;
                               ~~

miniprogram/typings/wx.d.ts:343:13 - error TS2451: Cannot redeclare block-scoped variable 'App'.

343 declare var App: AppConstructor;
                ~~~

  typings/wx/lib.wx.app.d.ts:11:19
    11 declare namespace App {
                         ~~~
    'App' was also declared here.
  typings/wx/lib.wx.app.d.ts:248:15
    248 declare const App: App.AppConstructor
                      ~~~
    and here.

miniprogram/typings/wx.d.ts:344:18 - error TS2451: Cannot redeclare block-scoped variable 'getApp'.

344 declare function getApp(): Application;
                     ~~~~~~

  typings/wx/lib.wx.app.d.ts:249:15
    249 declare const getApp: App.GetApp
                      ~~~~~~
    'getApp' was also declared here.

miniprogram/typings/wx.d.ts:346:18 - error TS2451: Cannot redeclare block-scoped variable 'getCurrentPages'.

346 declare function getCurrentPages(): Page[];
                     ~~~~~~~~~~~~~~~

  typings/wx/lib.wx.page.d.ts:181:15
    181 declare const getCurrentPages: Page.GetCurrentPages
                      ~~~~~~~~~~~~~~~
    'getCurrentPages' was also declared here.

miniprogram/typings/wx.d.ts:348:11 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

348 interface Page {
              ~~~~

  typings/wx/lib.wx.page.d.ts:11:19
    11 declare namespace Page {
                         ~~~~
    'Page' was also declared here.
  typings/wx/lib.wx.page.d.ts:180:15
    180 declare const Page: Page.PageConstructor
                      ~~~~
    and here.

miniprogram/typings/wx.d.ts:409:13 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

409 declare var Page: PageConstructor;
                ~~~~

  typings/wx/lib.wx.page.d.ts:11:19
    11 declare namespace Page {
                         ~~~~
    'Page' was also declared here.
  typings/wx/lib.wx.page.d.ts:180:15
    180 declare const Page: Page.PageConstructor
                      ~~~~
    and here.

miniprogram/typings/wx.d.ts:411:13 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

411 declare var wx: {
                ~~

  typings/wx/lib.wx.api.d.ts:11:19
    11 declare namespace wx {
                         ~~
    'wx' was also declared here.
  typings/wx/lib.wx.api.d.ts:12756:15
    12756 declare const wx: wx.Wx;
                        ~~
    and here.

typings/wx/lib.wx.api.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

11 declare namespace wx {
                     ~~

  miniprogram/typings/wx.d.ts:411:13
    411 declare var wx: {
                    ~~
    'wx' was also declared here.

typings/wx/lib.wx.api.d.ts:12756:15 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

12756 declare const wx: wx.Wx;
                    ~~

  miniprogram/typings/wx.d.ts:411:13
    411 declare var wx: {
                    ~~
    'wx' was also declared here.

typings/wx/lib.wx.api.d.ts:12756:22 - error TS2694: Namespace 'wx' has no exported member 'Wx'.

12756 declare const wx: wx.Wx;
                           ~~

typings/wx/lib.wx.app.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'App'.

11 declare namespace App {
                     ~~~

  miniprogram/typings/wx.d.ts:343:13
    343 declare var App: AppConstructor;
                    ~~~
    'App' was also declared here.

typings/wx/lib.wx.app.d.ts:248:15 - error TS2451: Cannot redeclare block-scoped variable 'App'.

248 declare const App: App.AppConstructor
                  ~~~

  miniprogram/typings/wx.d.ts:343:13
    343 declare var App: AppConstructor;
                    ~~~
    'App' was also declared here.

typings/wx/lib.wx.app.d.ts:248:20 - error TS2503: Cannot find namespace 'App'.

248 declare const App: App.AppConstructor
                       ~~~

typings/wx/lib.wx.app.d.ts:249:15 - error TS2451: Cannot redeclare block-scoped variable 'getApp'.

249 declare const getApp: App.GetApp
                  ~~~~~~

  miniprogram/typings/wx.d.ts:344:18
    344 declare function getApp(): Application;
                         ~~~~~~
    'getApp' was also declared here.

typings/wx/lib.wx.app.d.ts:249:23 - error TS2503: Cannot find namespace 'App'.

249 declare const getApp: App.GetApp
                          ~~~

typings/wx/lib.wx.page.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

11 declare namespace Page {
                     ~~~~

  miniprogram/typings/wx.d.ts:348:11
    348 interface Page {
                  ~~~~
    'Page' was also declared here.
  miniprogram/typings/wx.d.ts:409:13
    409 declare var Page: PageConstructor;
                    ~~~~
    and here.

typings/wx/lib.wx.page.d.ts:180:15 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

180 declare const Page: Page.PageConstructor
                  ~~~~

  miniprogram/typings/wx.d.ts:348:11
    348 interface Page {
                  ~~~~
    'Page' was also declared here.
  miniprogram/typings/wx.d.ts:409:13
    409 declare var Page: PageConstructor;
                    ~~~~
    and here.

typings/wx/lib.wx.page.d.ts:180:21 - error TS2702: 'Page' only refers to a type, but is being used as a namespace here.

180 declare const Page: Page.PageConstructor
                        ~~~~

typings/wx/lib.wx.page.d.ts:181:15 - error TS2451: Cannot redeclare block-scoped variable 'getCurrentPages'.

181 declare const getCurrentPages: Page.GetCurrentPages
                  ~~~~~~~~~~~~~~~

  miniprogram/typings/wx.d.ts:346:18
    346 declare function getCurrentPages(): Page[];
                         ~~~~~~~~~~~~~~~
    'getCurrentPages' was also declared here.

typings/wx/lib.wx.page.d.ts:181:32 - error TS2702: 'Page' only refers to a type, but is being used as a namespace here.

181 declare const getCurrentPages: Page.GetCurrentPages
                                   ~~~~


Found 25 errors.


F:\html\es6>node ./node_modules/typescript/lib/tsc.js
miniprogram/typings/wx.d.ts:343:13 - error TS2451: Cannot redeclare block-scoped variable 'App'.

343 declare var App: AppConstructor;
                ~~~

  typings/wx/lib.wx.app.d.ts:11:19
    11 declare namespace App {
                         ~~~
    'App' was also declared here.
  typings/wx/lib.wx.app.d.ts:248:15
    248 declare const App: App.AppConstructor
                      ~~~
    and here.

miniprogram/typings/wx.d.ts:344:18 - error TS2451: Cannot redeclare block-scoped variable 'getApp'.

344 declare function getApp(): Application;
                     ~~~~~~

  typings/wx/lib.wx.app.d.ts:249:15
    249 declare const getApp: App.GetApp
                      ~~~~~~
    'getApp' was also declared here.

miniprogram/typings/wx.d.ts:346:18 - error TS2451: Cannot redeclare block-scoped variable 'getCurrentPages'.

346 declare function getCurrentPages(): Page[];
                     ~~~~~~~~~~~~~~~

  typings/wx/lib.wx.page.d.ts:181:15
    181 declare const getCurrentPages: Page.GetCurrentPages
                      ~~~~~~~~~~~~~~~
    'getCurrentPages' was also declared here.

miniprogram/typings/wx.d.ts:348:11 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

348 interface Page {
              ~~~~

  typings/wx/lib.wx.page.d.ts:11:19
    11 declare namespace Page {
                         ~~~~
    'Page' was also declared here.
  typings/wx/lib.wx.page.d.ts:180:15
    180 declare const Page: Page.PageConstructor
                      ~~~~
    and here.

miniprogram/typings/wx.d.ts:409:13 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

409 declare var Page: PageConstructor;
                ~~~~

  typings/wx/lib.wx.page.d.ts:11:19
    11 declare namespace Page {
                         ~~~~
    'Page' was also declared here.
  typings/wx/lib.wx.page.d.ts:180:15
    180 declare const Page: Page.PageConstructor
                      ~~~~
    and here.

miniprogram/typings/wx.d.ts:411:13 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

411 declare var wx: {
                ~~

  typings/wx/lib.wx.api.d.ts:11:19
    11 declare namespace wx {
                         ~~
    'wx' was also declared here.
  typings/wx/lib.wx.api.d.ts:12756:15
    12756 declare const wx: wx.Wx;
                        ~~
    and here.

typings/wx/lib.wx.api.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

11 declare namespace wx {
                     ~~

  miniprogram/typings/wx.d.ts:411:13
    411 declare var wx: {
                    ~~
    'wx' was also declared here.

typings/wx/lib.wx.api.d.ts:12756:15 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

12756 declare const wx: wx.Wx;
                    ~~

  miniprogram/typings/wx.d.ts:411:13
    411 declare var wx: {
                    ~~
    'wx' was also declared here.

typings/wx/lib.wx.api.d.ts:12756:22 - error TS2694: Namespace 'wx' has no exported member 'Wx'.

12756 declare const wx: wx.Wx;
                           ~~

typings/wx/lib.wx.app.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'App'.

11 declare namespace App {
                     ~~~

  miniprogram/typings/wx.d.ts:343:13
    343 declare var App: AppConstructor;
                    ~~~
    'App' was also declared here.

typings/wx/lib.wx.app.d.ts:248:15 - error TS2451: Cannot redeclare block-scoped variable 'App'.

248 declare const App: App.AppConstructor
                  ~~~

  miniprogram/typings/wx.d.ts:343:13
    343 declare var App: AppConstructor;
                    ~~~
    'App' was also declared here.

typings/wx/lib.wx.app.d.ts:248:20 - error TS2503: Cannot find namespace 'App'.

248 declare const App: App.AppConstructor
                       ~~~

typings/wx/lib.wx.app.d.ts:249:15 - error TS2451: Cannot redeclare block-scoped variable 'getApp'.

249 declare const getApp: App.GetApp
                  ~~~~~~

  miniprogram/typings/wx.d.ts:344:18
    344 declare function getApp(): Application;
                         ~~~~~~
    'getApp' was also declared here.

typings/wx/lib.wx.app.d.ts:249:23 - error TS2503: Cannot find namespace 'App'.

249 declare const getApp: App.GetApp
                          ~~~

typings/wx/lib.wx.page.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

11 declare namespace Page {
                     ~~~~

  miniprogram/typings/wx.d.ts:348:11
    348 interface Page {
                  ~~~~
    'Page' was also declared here.
  miniprogram/typings/wx.d.ts:409:13
    409 declare var Page: PageConstructor;
                    ~~~~
    and here.

typings/wx/lib.wx.page.d.ts:180:15 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

180 declare const Page: Page.PageConstructor
                  ~~~~

  miniprogram/typings/wx.d.ts:348:11
    348 interface Page {
                  ~~~~
    'Page' was also declared here.
  miniprogram/typings/wx.d.ts:409:13
    409 declare var Page: PageConstructor;
                    ~~~~
    and here.

typings/wx/lib.wx.page.d.ts:180:21 - error TS2702: 'Page' only refers to a type, but is being used as a namespace here.

F:\html\es6>node ./node_modules/typescript/lib/tsc.js
miniprogram/typings/wx.d.ts:343:13 - error TS2451: Cannot redeclare block-scoped variable 'App'.

343 declare var App: AppConstructor;
                ~~~

  typings/wx/lib.wx.app.d.ts:11:19
    11 declare namespace App {
                         ~~~
    'App' was also declared here.
  typings/wx/lib.wx.app.d.ts:248:15
    248 declare const App: App.AppConstructor
                      ~~~
    and here.

miniprogram/typings/wx.d.ts:344:18 - error TS2451: Cannot redeclare block-scoped variable 'getApp'.

344 declare function getApp(): Application;
                     ~~~~~~

  typings/wx/lib.wx.app.d.ts:249:15
    249 declare const getApp: App.GetApp
                      ~~~~~~
    'getApp' was also declared here.

miniprogram/typings/wx.d.ts:346:18 - error TS2451: Cannot redeclare block-scoped variable 'getCurrentPages'.

346 declare function getCurrentPages(): Page[];
                     ~~~~~~~~~~~~~~~

  typings/wx/lib.wx.page.d.ts:181:15
    181 declare const getCurrentPages: Page.GetCurrentPages
                      ~~~~~~~~~~~~~~~
    'getCurrentPages' was also declared here.

miniprogram/typings/wx.d.ts:348:11 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

348 interface Page {
              ~~~~

  typings/wx/lib.wx.page.d.ts:11:19
    11 declare namespace Page {
                         ~~~~
    'Page' was also declared here.
  typings/wx/lib.wx.page.d.ts:180:15
    180 declare const Page: Page.PageConstructor
                      ~~~~
    and here.

miniprogram/typings/wx.d.ts:409:13 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

409 declare var Page: PageConstructor;
                ~~~~

  typings/wx/lib.wx.page.d.ts:11:19
    11 declare namespace Page {
                         ~~~~
    'Page' was also declared here.
  typings/wx/lib.wx.page.d.ts:180:15
    180 declare const Page: Page.PageConstructor
                      ~~~~
    and here.

miniprogram/typings/wx.d.ts:411:13 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

411 declare var wx: {
                ~~

  typings/wx/lib.wx.api.d.ts:11:19
    11 declare namespace wx {
                         ~~
    'wx' was also declared here.
  typings/wx/lib.wx.api.d.ts:12756:15
    12756 declare const wx: wx.Wx;
                        ~~
    and here.

typings/wx/lib.wx.api.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

11 declare namespace wx {
                     ~~

  miniprogram/typings/wx.d.ts:411:13
    411 declare var wx: {
                    ~~
    'wx' was also declared here.

typings/wx/lib.wx.api.d.ts:12756:15 - error TS2451: Cannot redeclare block-scoped variable 'wx'.

12756 declare const wx: wx.Wx;
                    ~~

  miniprogram/typings/wx.d.ts:411:13
    411 declare var wx: {
                    ~~
    'wx' was also declared here.

typings/wx/lib.wx.api.d.ts:12756:22 - error TS2694: Namespace 'wx' has no exported member 'Wx'.

12756 declare const wx: wx.Wx;
                           ~~

typings/wx/lib.wx.app.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'App'.

11 declare namespace App {
                     ~~~

  miniprogram/typings/wx.d.ts:343:13
    343 declare var App: AppConstructor;
                    ~~~
    'App' was also declared here.

typings/wx/lib.wx.app.d.ts:248:15 - error TS2451: Cannot redeclare block-scoped variable 'App'.

248 declare const App: App.AppConstructor
                  ~~~

  miniprogram/typings/wx.d.ts:343:13
    343 declare var App: AppConstructor;
                    ~~~
    'App' was also declared here.

typings/wx/lib.wx.app.d.ts:248:20 - error TS2503: Cannot find namespace 'App'.

248 declare const App: App.AppConstructor
                       ~~~

typings/wx/lib.wx.app.d.ts:249:15 - error TS2451: Cannot redeclare block-scoped variable 'getApp'.

249 declare const getApp: App.GetApp
                  ~~~~~~

  miniprogram/typings/wx.d.ts:344:18
    344 declare function getApp(): Application;
                         ~~~~~~
    'getApp' was also declared here.

typings/wx/lib.wx.app.d.ts:249:23 - error TS2503: Cannot find namespace 'App'.

249 declare const getApp: App.GetApp
                          ~~~

typings/wx/lib.wx.page.d.ts:11:19 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

11 declare namespace Page {
                     ~~~~

  miniprogram/typings/wx.d.ts:348:11
    348 interface Page {
                  ~~~~
    'Page' was also declared here.
  miniprogram/typings/wx.d.ts:409:13
    409 declare var Page: PageConstructor;
                    ~~~~
    and here.

typings/wx/lib.wx.page.d.ts:180:15 - error TS2451: Cannot redeclare block-scoped variable 'Page'.

180 declare const Page: Page.PageConstructor
                  ~~~~

  miniprogram/typings/wx.d.ts:348:11
    348 interface Page {
                  ~~~~
    'Page' was also declared here.
  miniprogram/typings/wx.d.ts:409:13
    409 declare var Page: PageConstructor;
                    ~~~~
    and here.

typings/wx/lib.wx.page.d.ts:180:21 - error TS2702: 'Page' only refers to a type, but is being used as a namespace here.

180 declare const Page: Page.PageConstructor
                        ~~~~

typings/wx/lib.wx.page.d.ts:181:15 - error TS2451: Cannot redeclare block-scoped variable 'getCurrentPages'.

181 declare const getCurrentPages: Page.GetCurrentPages
                  ~~~~~~~~~~~~~~~

  miniprogram/typings/wx.d.ts:346:18
    346 declare function getCurrentPages(): Page[];
                         ~~~~~~~~~~~~~~~
    'getCurrentPages' was also declared here.

typings/wx/lib.wx.page.d.ts:181:32 - error TS2702: 'Page' only refers to a type, but is being used as a namespace here.

181 declare const getCurrentPages: Page.GetCurrentPages
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
TypeScript是一种静态类型的编程语言,它是对JavaScript的超集,在其基础上添加了类型系统和其他新的特性。微信小程序是一种可以在微信平台上运行的小型应用程序,通过使用微信小程序开发框架,可以使用HTML、CSS和JavaScript来构建小程序。那么,TypeScript微信小程序源码是指使用TypeScript来编写的微信小程序的源代码。 TypeScript的主要优点之一是提供了强大的类型检查功能,可以在代码编写过程中就能检测出潜在的类型错误。通过使用TypeScript来编写微信小程序,可以提高代码的可维护性和可读性,并且减少运行时的错误TypeScript微信小程序源码通常会包含以下内容: 1. App实例:定义小程序的全局配置和生命周期函数。 2. 页面文件:包括wxml模板、wxss样式表和TypeScript脚本文件。这些文件用来定义小程序的页面结构、样式和逻辑。 3. 组件文件:包括wxml模板、wxss样式表和TypeScript脚本文件。这些文件用来定义小程序中的自定义组件,可以在多个页面中重复使用。 4. 工具函数:用来封装一些常用的功能,比如网络请求、数据处理等。 5. 配置文件:包括app.json和project.config.json。app.json用来配置小程序的全局配置项,project.config.json用来配置项目的一些基本信息。 在使用TypeScript微信小程序源码时,首先需要安装TypeScript编译器,并在项目中配置好TypeScript编译选项。然后,将JavaScript源码文件转换为TypeScript源码文件,并在代码中添加类型注解和其他TypeScript的特性。最后,通过TypeScript编译器将TypeScript源码编译为可以在微信小程序平台上运行的JavaScript代码。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值