Giter Club home page Giter Club logo

Comments (18)

orizens avatar orizens commented on June 8, 2024 6

@lucienimmink install npm i @types/youtube

from ngx-youtube-player.

orizens avatar orizens commented on June 8, 2024 5

please use version 0.0.28 for now.
npm i @types/[email protected]

from ngx-youtube-player.

cbjerg avatar cbjerg commented on June 8, 2024 3

run npm i @types/youtube and everything should work

from ngx-youtube-player.

lucienimmink avatar lucienimmink commented on June 8, 2024 2

awesome, might as well put that in the docs somewhere!

from ngx-youtube-player.

simeyla avatar simeyla commented on June 8, 2024 2

This is still confusing the heck out of me. In the end adding youtube to types solved it for me and either ng build or ng serve worked fine:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "types": ["youtube"]
  },
  "exclude": [
    "src/test.ts",
    "**/*.spec.ts"
  ]
}

Without this I was able to get the types installed for Visual Studio Code (nothing was underlined), but on compilation I'd get errors about YT being undefined.

@orizens I see that you did some crazy things in the 6.0 update such as calling win()['YT'] manually. Were you just as confused as me or was there a reason you didn't add "youtube" to types.

from ngx-youtube-player.

orizens avatar orizens commented on June 8, 2024 1

win()['YT'] returns the actual youtube object and isn't related to the YT interface.

from ngx-youtube-player.

dineshk16feb avatar dineshk16feb commented on June 8, 2024

I have one more issues similar like that after installing @type/youtube,

"Namespace 'YT' has no exported member 'EventArgs' "

from ngx-youtube-player.

orizens avatar orizens commented on June 8, 2024

hi - i upgraded the package to "@types/youtube": "0.0.29"

from ngx-youtube-player.

 avatar commented on June 8, 2024

i got the same issue
node_modules/ng2-youtube-player/src/models.d.ts(6,30): error TS2694: Namespace 'YT' has no exported member 'PlayerEvent'.
please somebody help

from ngx-youtube-player.

 avatar commented on June 8, 2024

fire this below commend
npm install @types/youtube --save

problem resolved.its work for me

from ngx-youtube-player.

 avatar commented on June 8, 2024

npm install @types/youtube --save

from ngx-youtube-player.

orizens avatar orizens commented on June 8, 2024

Please install latest version

from ngx-youtube-player.

kukac7 avatar kukac7 commented on June 8, 2024

the latest version still gives the issue:

[at-loader] Checking finished with 16 errors
Error in bail mode: [at-loader] ./node_modules/ng2-youtube-player/src/models.d.ts:1:1 
    TS2688: Cannot find type definition file for 'youtube'.```

from ngx-youtube-player.

alex-samuilov avatar alex-samuilov commented on June 8, 2024

I use version 0.0.30 and have the same errors:
Cannot find namespace 'YT'.
Cannot find name 'YT'.

from ngx-youtube-player.

lucienimmink avatar lucienimmink commented on June 8, 2024

Using 0.0.30 or 0.0.41

ERROR in node_modules/ngx-youtube-player/src/models.d.ts(5,26): error TS2503: Cannot find namespace 'YT'.
node_modules/ngx-youtube-player/src/models.d.ts(6,27): error TS2503: Cannot find namespace 'YT'.
node_modules/ngx-youtube-player/src/models.d.ts(1,23): error TS2688: Cannot find type definition file for 'youtu
be'.
node_modules/ngx-youtube-player/src/services/youtube-player.service.d.ts(10,24): error TS2503: Cannot find names
pace 'YT'.
node_modules/ngx-youtube-player/src/services/youtube-player.service.d.ts(15,110): error TS2503: Cannot find name
space 'YT'.
node_modules/ngx-youtube-player/src/services/youtube-player.service.d.ts(16,18): error TS2503: Cannot find names
pace 'YT'.
node_modules/ngx-youtube-player/src/services/youtube-player.service.d.ts(17,19): error TS2503: Cannot find names
pace 'YT'.
node_modules/ngx-youtube-player/src/services/youtube-player.service.d.ts(18,35): error TS2503: Cannot find names
pace 'YT'.
node_modules/ngx-youtube-player/src/services/youtube-player.service.d.ts(19,23): error TS2503: Cannot find names
pace 'YT'.
node_modules/ngx-youtube-player/src/services/youtube-player.service.d.ts(20,113): error TS2503: Cannot find name
space 'YT'.
node_modules/ngx-youtube-player/src/services/youtube-player.service.d.ts(21,30): error TS2503: Cannot find names
pace 'YT'.
node_modules/ngx-youtube-player/src/services/youtube-player.service.d.ts(1,23): error TS2688: Cannot find type d
efinition file for 'youtube'.
node_modules/ngx-youtube-player/src/modules/youtube-player.component.d.ts(17,17): error TS2503: Cannot find name
space 'YT'.
node_modules/ngx-youtube-player/src/modules/youtube-player.component.d.ts(18,25): error TS2503: Cannot find name
space 'YT'.
node_modules/ngx-youtube-player/src/modules/youtube-player.component.d.ts(19,26): error TS2503: Cannot find name
space 'YT'.
node_modules/ngx-youtube-player/src/modules/youtube-player.component.d.ts(1,23): error TS2688: Cannot find type
definition file for 'youtube'.

from ngx-youtube-player.

AllefDouglasDev avatar AllefDouglasDev commented on June 8, 2024

WHAT I DID?
First: run npm i @types/youtube
Secund: run npm i
and finaly:
In the package .\node_modules\ng2-youtube-player\src\modules has youtube-player.component.d.ts
or .\node_modules\ngx-youtube-player\src\modules has youtube-player.component.d.ts
Change line 18 to : change: EventEmitter<YT.PlayerState>;
If has more files with "YT.PlayerEvent", change to YT.PlayerState

from ngx-youtube-player.

orizens avatar orizens commented on June 8, 2024

@simeyla actually, in v6, "@types/youtube" is now set as a dependency.
I was wondering to move it into peerDepdencies. any suggestion?

from ngx-youtube-player.

simeyla avatar simeyla commented on June 8, 2024

@orizens I'm not really an expert on how everything fits together. I just got the impression that by doing win()['YT'] you were trying to solve a problem you couldn't find another solution to. I made my own control and looked at your code to see how you were fixing the problem of YT not being defined at compile time even though my editor could recognize it. Adding "types": ["youtube"] to the compilerOptions fixed that for me. I guess I don't understand how installing a types package alone isn't enough to make the compiler recognize it, but I was going round in circles trying to find an explanation.

from ngx-youtube-player.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.