Angular 9: Not exist on type 'JQuery<any>'

See original GitHub issue

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 8.2

Description

In previus version i don’t have this error i define types for my Jquery extension:

declare var ForMaps:any

interface JQuery {
    forMapsSearch(options?: any): any;
    forMapsDraw(options?: any): any;
    forMapsMarker(options?: any): any;
    forMapsCatasto(options?: any): any;
    forMapsTavolare(options?: any): any;    
    forMapsOmi(options?: any): any;
    forMapsLivelliAmministrativi(options?: any): any;
    forMapsPuntiFiduciali(options?: any): any;
    forMapsElencoNazionale(options?: any): any;
    forMapsPoi(options?: any): any;
    forMapsAnnunci(options?: any): any;

}

πŸ”¬ Minimal Reproduction

ng serve

πŸ”₯ Exception or Error




ERROR in src/app/component/for-maps/for-maps.component.ts:41:24 - error TS2304: Cannot find name 'ForMaps'.
    
    41     this.forMaps = new ForMaps(this.IdMappa,
                              ~~~~~~~
    src/app/component/for-maps/for-maps.component.ts:52:21 - error TS2339: Property 'forMapsDraw' does not exist on type 'JQuery<any>'.
    
    52     $(this.forMaps).forMapsDraw();
                           ~~~~~~~~~~~
    src/app/component/for-maps/for-maps.component.ts:53:21 - error TS2339: Property 'forMapsCatasto' does not exist on type 'JQuery<any>'.
    
    53     $(this.forMaps).forMapsCatasto();
                           ~~~~~~~~~~~~~~
    src/app/component/for-maps/for-maps.component.ts:54:21 - error TS2339: Property 'forMapsTavolare' does not exist on type 'JQuery<any>'.
    
    54     $(this.forMaps).forMapsTavolare();
                           ~~~~~~~~~~~~~~~
    src/app/component/for-maps/for-maps.component.ts:55:21 - error TS2339: Property 'forMapsOmi' does not exist on type 'JQuery<any>'.
    
    55     $(this.forMaps).forMapsOmi();
                           ~~~~~~~~~~
    src/app/component/for-maps/for-maps.component.ts:56:21 - error TS2339: Property 'forMapsLivelliAmministrativi' does not exist on type 'JQuery<any>'.
    
    56     $(this.forMaps).forMapsLivelliAmministrativi();
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/app/component/for-maps/for-maps.component.ts:57:21 - error TS2339: Property 'forMapsPuntiFiduciali' does not exist on type 'JQuery<any>'.
    
    57     $(this.forMaps).forMapsPuntiFiduciali();
                           ~~~~~~~~~~~~~~~~~~~~~
    src/app/component/for-maps/for-maps.component.ts:58:21 - error TS2339: Property 'forMapsPoi' does not exist on type 'JQuery<any>'.
    
    58     $(this.forMaps).forMapsPoi();
                           ~~~~~~~~~~
    src/app/component/for-maps/for-maps.component.ts:59:21 - error TS2339: Property 'forMapsAnnunci' does not exist on type 'JQuery<any>'.
    
    59     $(this.forMaps).forMapsAnnunci();
                           ~~~~~~~~~~~~~~
    src/app/component/for-maps/for-maps.component.ts:67:30 - error TS2686: 'L' refers to a UMD global, but the current file is a module. Consider adding an import instead.
    
    67            latLng: new (<any>L).latLng(x.Latitudine, x.Longitudine),
                                    ~
    src/app/component/for-maps/for-maps.component.ts:97:53 - error TS2686: 'L' refers to a UMD global, but the current file is a module. Consider adding an import instead.
    
    97       (<any>this.forMaps.map).flyToBounds(new (<any>L).LatLngBounds(listcoordinate));
                                                           ~
    src/app/component/for-maps/for-maps.component.ts:106:25 - error TS2686: 'L' refers to a UMD global, but the current file is a module. Consider adding an import instead.
    
    106           latLng: (<any>L).latLng(component.Latitudine, component.Longitudine),
                                ~
    src/app/component/for-maps/for-maps.component.ts:115:26 - error TS2686: 'L' refers to a UMD global, but the current file is a module. Consider adding an import instead.
    
    115         .setLatLng((<any>L).latLng(component.Latitudine, component.Longitudine));
                                 ~
    src/app/component/for-maps/for-maps.component.ts:127:25 - error TS2686: 'L' refers to a UMD global, but the current file is a module. Consider adding an import instead.
    
    127           latLng: (<any>L).latLng(change.Latitudine.currentValue, change.Longitudine.currentValue),
                                ~
    src/app/component/for-maps/for-maps.component.ts:136:26 - error TS2686: 'L' refers to a UMD global, but the current file is a module. Consider adding an import instead.
    
    136         .setLatLng((<any>L).latLng(change.Latitudine.currentValue, change.Longitudine.currentValue));
        

🌍 Your Environment




     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.0.1
Node: 13.7.0
OS: win32 x64

Angular: 9.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, material-moment-adapter
... platform-browser, platform-browser-dynamic, router
... service-worker
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.1
@angular-devkit/build-angular     0.900.1
@angular-devkit/build-optimizer   0.900.1
@angular-devkit/build-webpack     0.900.1
@angular-devkit/core              9.0.1
@angular-devkit/schematics        9.0.1
@angular/cli                      9.0.1
@angular/flex-layout              9.0.0-beta.29
@ngtools/webpack                  9.0.1
@schematics/angular               9.0.1
@schematics/update                0.900.1
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

Anything else relevant?

tsconfig.app.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": [ "jquery", "googlemaps","node" ],
    "allowJs": true
    
  },  "files": [
    "main.ts",
    "polyfills.ts"
  ]
}

tsconfig.spec.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/spec",
    "types": [
      "jasmine",
      "node"
    ]
  },
  "files": [
    "test.ts",
    "polyfills.ts"
  ],
  "include": [
    "**/*.spec.ts",
    "**/*.d.ts"
  ]
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

0reactions
angular-automatic-lock-bot[bot]commented, Mar 12, 2020

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error TS2339: Property 'modal' does not exist on type 'JQuery'
When I upgrade angular to version 9, I faced this issue. Here are my solution, ... Property 'DataTable' does not exist on type...
Read more >
error TS2339: Property 'modal' does not exist on type 'JQuery'
jQuery : error TS2339: Property 'modal' does not exist on type ' JQuery ' [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ]Β ...
Read more >
TS2339 error, Typescript β€” DataTables forums
I have this error : TS2339: Property 'DataTable' does not exist on type 'JQuery<HTMLElement>' , Anyone know, how can I fix this error!...
Read more >
Integrate jQuery Full Calendar with Angular 4 | by RadicalLoop
Property 'fullCalendar' does not exist on type 'JQuery'. It means Typescript compiler couldn't find β€œfullCalendar” interface in jQuery interface.
Read more >
Property 'value' does not exist on type 'HTMLElement' in TS
To solve the error, use a type assertion to type the element as HTMLInputElement before accessing the property. property value not exist type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found