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 'includes' does not exist on type 'string[]' #2

Closed
emcniece opened this issue Sep 21, 2016 · 6 comments
Closed

Property 'includes' does not exist on type 'string[]' #2

emcniece opened this issue Sep 21, 2016 · 6 comments

Comments

@emcniece
Copy link

emcniece commented Sep 21, 2016

Attempting to use this within an Ionic 2 app (Typescript, Angular 2).

Error dump:

➜  i2-app ionic serve

Running 'serve:before' gulp task before serve
[15:57:06] Starting 'clean'...
[15:57:06] Finished 'clean' after 37 ms
[15:57:06] Starting 'watch'...
[15:57:06] Starting 'sass'...
[15:57:06] Starting 'html'...
[15:57:06] Starting 'fonts'...
[15:57:06] Starting 'scripts'...
[15:57:06] Finished 'scripts' after 40 ms
[15:57:06] Finished 'html' after 43 ms
[15:57:06] Finished 'fonts' after 46 ms
[15:57:07] Finished 'sass' after 799 ms
TypeScript error: /appdir/node_modules/ng2-logger/src/log.ts(12,52): Error TS2339: Property 'includes' does not exist on type 'string[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/log.ts(41,25): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/log.ts(43,42): Error TS2339: Property 'name' does not exist on type 'typeof Log'.
TypeScript error: /appdir/node_modules/ng2-logger/src/log.ts(46,42): Error TS2339: Property 'name' does not exist on type 'typeof Log'.
TypeScript error: /appdir/node_modules/ng2-logger/src/log.ts(49,42): Error TS2339: Property 'name' does not exist on type 'typeof Log'.
TypeScript error: /appdir/node_modules/ng2-logger/src/log.ts(52,42): Error TS2339: Property 'name' does not exist on type 'typeof Log'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(15,54): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(16,30): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(19,60): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(26,54): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(27,30): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(30,60): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(37,54): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(38,30): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(41,60): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(48,54): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(49,30): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
TypeScript error: /appdir/node_modules/ng2-logger/src/logger.ts(52,60): Error TS2339: Property 'includes' does not exist on type 'Level[]'.
[15:57:09] Finished 'watch' after 3.07 s
[15:57:09] Starting 'serve:before'...
[15:57:09] Finished 'serve:before' after 3.77 μs

Running live reload server: http://localhost:35729
Watching: www/**/*, !www/lib/**/*
√ Running dev server:  http://localhost:8100
Ionic server commands, enter:
  restart or r to restart the client app from the root
  goto or g and a url to have the app navigate to the given url
  consolelogs or c to enable/disable console log output
  serverlogs or s to enable/disable server log output
  quit or q to shutdown the server and exit

ionic $
/appdir/node_modules/ng2-logger/ng2-logger.ts:1
export * from './src';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

app.ts:

import { Component } from '@angular/core';
import { Platform, ionicBootstrap } from 'ionic-angular';
import { StatusBar } from 'ionic-native';
import { TabsPage } from './pages/tabs/tabs';

import { Log, Level } from 'ng2-logger/ng2-logger'

const log = Log.create('app');

@Component({
  template: '<ion-nav [root]="rootPage"></ion-nav>'
})
export class MyApp {

  public rootPage: any;

  constructor(private platform: Platform) {
    this.rootPage = TabsPage;
    let obj = {test: 1};

    log.d('object',obj) // console.log
    log.er('object',obj) // console.error
    log.i('object',obj) // console.info
    log.w('object',obj) // console.warn
    console.log('here')

    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
    });
  }
}

ionicBootstrap(MyApp);

Any ideas?

@KrzysiekT
Copy link

KrzysiekT commented Sep 29, 2016

Bump, same here.

@darekf77
Copy link
Owner

What version of typescript are you using @emcniece ?

@darekf77
Copy link
Owner

I think, with typescript 2.0 everything should be ok microsoft/TypeScript#2340

@emcniece
Copy link
Author

Typescript 2.0.3.

package.json:

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
  "dependencies": {
    "@ionic/storage": "^1.0.3",
    "ionic-angular": "^2.0.0-rc.0",
    "ionic-native": "^2.0.3",
    "ionicons": "^3.0.0",
    "underscore": "^1.8.3"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^0.0.23",
    "typescript": "^2.0.3"
  },
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "description": "aurora-app: An Ionic project"
}

tsconfig.json:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "target": "es5"
  },
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

tslint.json:

{
  "rules": {
    "no-duplicate-variable": true,
    "no-unused-variable": [
      true
    ]
  },
  "rulesDirectory": [
    "node_modules/tslint-eslint-rules/dist/rules"
  ]
}

@bjornharvold
Copy link

+1 Typescript 2.0.2

@darekf77
Copy link
Owner

darekf77 commented Sep 30, 2016

fixed in new version 0.1.11

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

4 participants