Vue-cli: Property 'observable' does not exist on type 'SymbolConstructor'.

Created on 10 Jun 2019  路  1Comment  路  Source: vuejs/vue-cli

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

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BusyHe picture BusyHe  路  3Comments

joshuajohnson814 picture joshuajohnson814  路  3Comments

wahidrahim picture wahidrahim  路  3Comments

b-zee picture b-zee  路  3Comments

csakis picture csakis  路  3Comments