{"action":"created","issue":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/28418","repository_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped","labels_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/28418/labels{/name}","comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/28418/comments","events_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/28418/events","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/issues/28418","id":354242583,"node_id":"MDU6SXNzdWUzNTQyNDI1ODM=","number":28418,"title":"@types/video.js has no default export","user":{"login":"meikidd","id":376338,"node_id":"MDQ6VXNlcjM3NjMzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/376338?v=4","gravatar_id":"","url":"https://api.github.com/users/meikidd","html_url":"https://github.com/meikidd","followers_url":"https://api.github.com/users/meikidd/followers","following_url":"https://api.github.com/users/meikidd/following{/other_user}","gists_url":"https://api.github.com/users/meikidd/gists{/gist_id}","starred_url":"https://api.github.com/users/meikidd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meikidd/subscriptions","organizations_url":"https://api.github.com/users/meikidd/orgs","repos_url":"https://api.github.com/users/meikidd/repos","events_url":"https://api.github.com/users/meikidd/events{/privacy}","received_events_url":"https://api.github.com/users/meikidd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-08-27T09:16:59Z","updated_at":"2018-09-10T02:43:16Z","closed_at":null,"author_association":"NONE","body":"- [x] I tried using the `@types/video.js` package and had problems.\r\n- [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript \r\n- Authors: @vbortone @scleriot @SWBennett06 @IgelCampus @giofreitas @gjanblaszczyk \r\n\r\nI got an error of `\"@types/video.js/index\" has no default export.`\r\n![image](https://user-images.githubusercontent.com/376338/44651500-2ae11380-aa1c-11e8-8cd9-0bc6d6ba8fdc.png)\r\n\r\nHere is my Component file which is following the video.js [offical tutorial for react](https://docs.videojs.com/tutorial-react.html)\r\n\r\n```\r\nimport * as React from 'react';\r\nimport videojs from 'video.js';\r\n\r\nexport interface Props {\r\n  videoOptions: videojs.PlayerOptions;\r\n}\r\n\r\nexport default class RecordPlayer extends React.Component<Props> {\r\n  private player?: videojs.Player;\r\n  private videoNode?: HTMLVideoElement;\r\n\r\n  constructor(props: Props) {\r\n    super(props);\r\n    this.player = undefined;\r\n    this.videoNode = undefined;\r\n  }\r\n  componentDidMount() {\r\n    this.player = videojs(this.videoNode, this.props.videoOptions).ready(\r\n      function onReady() {\r\n        // console.log('onPlayerReady', this);\r\n      },\r\n    );\r\n  }\r\n\r\n  // destroy player on unmount\r\n  componentWillUnmount() {\r\n    if (this.player) {\r\n      this.player.dispose();\r\n    }\r\n  }\r\n\r\n  // wrap the player in a div with a `data-vjs-player` attribute\r\n  // so videojs won't create additional wrapper in the DOM\r\n  // see https://github.com/videojs/video.js/pull/3856\r\n  public render() {\r\n    return (\r\n      <div>\r\n        <div data-vjs-player>\r\n          <video\r\n            ref={(node: HTMLVideoElement) => (this.videoNode = node)}\r\n            className=\"video-js\"\r\n          />\r\n        </div>\r\n      </div>\r\n    );\r\n  }\r\n}\r\n```\r\n\r\nI tried change\r\n\r\n```\r\nimport videojs from 'video.js';\r\n```\r\n\r\ninto \r\n\r\n```\r\nimport * as videojs from 'video.js';\r\n```\r\n\r\nthen I got another error \r\n\r\n```\r\nTypeError: __WEBPACK_IMPORTED_MODULE_1_video_js__ is not a function\r\n```\r\n\r\nversions\r\n\r\n- typescript version v3.0.1\r\n- @types/video.js version v7.2.1"},"comment":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/comments/419771578","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/issues/28418#issuecomment-419771578","issue_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/28418","id":419771578,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTc3MTU3OA==","user":{"login":"meikidd","id":376338,"node_id":"MDQ6VXNlcjM3NjMzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/376338?v=4","gravatar_id":"","url":"https://api.github.com/users/meikidd","html_url":"https://github.com/meikidd","followers_url":"https://api.github.com/users/meikidd/followers","following_url":"https://api.github.com/users/meikidd/following{/other_user}","gists_url":"https://api.github.com/users/meikidd/gists{/gist_id}","starred_url":"https://api.github.com/users/meikidd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meikidd/subscriptions","organizations_url":"https://api.github.com/users/meikidd/orgs","repos_url":"https://api.github.com/users/meikidd/repos","events_url":"https://api.github.com/users/meikidd/events{/privacy}","received_events_url":"https://api.github.com/users/meikidd/received_events","type":"User","site_admin":false},"created_at":"2018-09-10T02:43:16Z","updated_at":"2018-09-10T02:43:16Z","author_association":"NONE","body":"Hi @aahmyu, \r\nAccording to the official doc, set `compilerOptions.module` to `\"commonjs\"`, then use `import videojs = require(\"video.js\")` should work, but it doesn't on my side.\r\n\r\nI tired all kinds of possibilities, by combining the following:\r\n\r\n1. compilerOptions.module\r\n    - \"commonjs\"\r\n    - \"esnext\"\r\n\r\n2. import\r\n    - `import videojs = require(\"video.js\")` \r\n    - `import videojs from \"video.js\"` \r\n    - `import * as videojs from \"video.js\"`\r\n\r\nall these didn't work.\r\n\r\nAnd also, I tried to fix it and planned to create a pull request, but my approach can't pass the test case.\r\n\r\nFinally,  I made a local copy in my project, and modified it into:\r\n\r\n```\r\ndeclare module 'video.js' {\r\n  function videojs(...): videojs.Player;\r\n  namespace videojs {...}\r\n\r\n  export default videojs;\r\n}\r\n``` \r\nand then used `/// <reference path=\"./videojs.d.ts\"/>` to link it."}}
{"actor":{"display_login":"meikidd"}}