Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'observable' does not exist on type 'SymbolConstructor'. #4127

Closed
yuwu9145 opened this issue Jun 10, 2019 · 1 comment
Closed

Property 'observable' does not exist on type 'SymbolConstructor'. #4127

yuwu9145 opened this issue Jun 10, 2019 · 1 comment

Comments

@yuwu9145
Copy link

Version

3.8.0

Environment info

Environment Info:

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
  Binaries:
    Node: 10.14.1 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.0.0
    @vue/babel-preset-app:  3.8.0
    @vue/babel-preset-jsx:  1.0.0
    @vue/babel-sugar-functional-vue:  1.0.0
    @vue/babel-sugar-inject-h:  1.0.0
    @vue/babel-sugar-v-model:  1.0.0
    @vue/babel-sugar-v-on:  1.0.0
    @vue/cli-overlay:  3.8.0
    @vue/cli-plugin-babel: ^3.8.0 => 3.8.0
    @vue/cli-plugin-typescript: ^3.8.0 => 3.8.1
    @vue/cli-service: ^3.8.0 => 3.8.0
    @vue/cli-shared-utils:  3.8.0
    @vue/component-compiler-utils:  2.6.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    typescript: ^3.4.3 => 3.5.1
    vue: ^2.6.10 => 2.6.10
    vue-class-component: ^7.0.2 => 7.1.0
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.0
    vue-property-decorator: ^8.1.0 => 8.1.1
    vue-router: ^3.0.3 => 3.0.6
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.10 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.0.1 => 3.1.1
  npmGlobalPackages:
    @vue/cli: Not Found

Package.json:

  {
  "name": "sample-vue",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "axios": "^0.19.0",
    "bulma": "^0.7.5",
    "core-js": "^2.6.5",
    "rxjs": "^6.5.2",
    "vue": "^2.6.10",
    "vue-class-component": "^7.0.2",
    "vue-property-decorator": "^8.1.0",
    "vue-router": "^3.0.3",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@types/core-js": "^2.5.0",
    "@types/node": "^12.0.7",
    "@types/rx": "^4.1.1",
    "@vue/cli-plugin-babel": "^3.8.0",
    "@vue/cli-plugin-typescript": "^3.8.0",
    "@vue/cli-service": "^3.8.0",
    "node-sass": "^4.9.0",
    "sass-loader": "^7.1.0",
    "typescript": "^3.4.3",
    "vue-template-compiler": "^2.6.10"
  }
}

Steps to reproduce

  1. Create a ts file
  2. Do import { Observable } from 'rxjs/internal/Observable';
  3. Got error: Property 'observable' does not exist on type 'SymbolConstructor'.

What is expected?

No type checking error

What is actually happening?

image


If I do import { Observable } from 'rxjs';

There is no type checking error

@sodatea
Copy link
Member

sodatea commented Jun 11, 2019

It's an anti-pattern to import from rxjs/internals. You are not expected to use it that way.


As for the error, it's because this type declaration file (rxjs/internal/types/d.ts) depends on rxjs/internal/symbol/observable.d.ts but it's not explicitly listed. Though, in rxjs/index.d.ts both files are imported so you'll be fine if you just import it from rxjs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants