0

I have come across several types of errors I can write in Meteor/Angular code that seem to break the compiler without throwing an error. Some examples:

export const foo = {
  propA: 'abc',
  propB: 123;
  propc: 'value'
}

where the semicolon erroneously in the middle of the object breaks things badly. Another:

private _functionName( param1: string, param2: boolean; param3: string ): void { // do stuff here  }

Where again the semicolon is erroneously placed. Third:

const propertyName = thisArray.map( thing => return thing._id );

where the callback function should be wrapped in braces (a semicolon might've helped there too). Fourth:

import style    from './this.component.scss';

where the specified .scss file does not exist ( if it exists but is 0-byte that will pass - it's only the case that it doesn't exist that fails).

Each of these mistakes results in a clean compile on the server side, and an error-free client console with an application that hangs on the loading screen.

There is a question of if/how to reproduce; below are the specific environmental parameters I'm working under, on Amazon Linux.

  "devDependencies": {
    "@types/chai": "3.4.34",
    "@types/meteor": "^1.3.31",
    "@types/mocha": "2.2.34",
    "chai": "3.5.0",
    "chai-spies": "0.7.1"
  },
  "dependencies": {
    "@angular/animations": "^4.1.3",
    "@angular/common": "^4.1.3",
    "@angular/compiler": "^4.1.3",
    "@angular/core": "^4.1.3",
    "@angular/forms": "^4.1.3",
    "@angular/http": "^4.1.3",
    "@angular/material": "^2.0.0-beta.5",
    "@angular/platform-browser": "^4.1.3",
    "@angular/platform-browser-dynamic": "^4.1.3",
    "@angular/router": "^4.1.3",
    "@mahpah/angular-cropper": "0.0.1",
    "@ngx-translate/core": "^6.0.1",
    "@types/htmlparser2": "^3.7.29",
    "angular-draggable-droppable": "^1.0.1",
    "angular2-meteor": "^0.7.1",
    "angular2-meteor-accounts-ui": "^1.0.0",
    "angular2-meteor-polyfills": "^0.1.1",
    "angular2-meteor-tests-polyfills": "0.0.2",
    "babel-runtime": "^6.23.0",
    "hammerjs": "^2.0.8",
    "htmlparser2": "^3.9.2",
    "meteor-node-stubs": "^0.2.11",
    "meteor-rxjs": "^0.4.7",
    "ng-gallery": "^0.7.1",
    "ngx-pagination": "^3.0.0",
    "reflect-metadata": "^0.1.10",
    "rxjs": "^5.2.0",
    "simpl-schema": "^0.2.3",
    "zone.js": "^0.8.11"
  }

    [email protected]             # Packages every Meteor app needs to have
    [email protected]       # Packages for a great mobile UX
    [email protected]                   # The database Meteor supports right now
    [email protected]            # Reactive variable for tracker
    [email protected]                 # Meteor's client-side reactive programming library

    [email protected]   # CSS minifier run for production mode
    [email protected]    # JS minifier run for production mode
    [email protected]                # ECMAScript 5 compatibility for older browsers.

    angular2-compilers
    practicalmeteor:mocha
    xolvio:cleaner
    hwillson:stub-collections
    dispatch:mocha-phantomjs
    [email protected]
    aldeed:collection2-core
    aldeed:schema-deny
    aldeed:schema-index
    mdg:validated-method
    mdg:validation-error
    [email protected]
    alanning:roles
    tmeasday:publish-counts
    dburles:collection-helpers
    matb33:collection-hooks
    [email protected]
    edgee:slingshot
    [email protected]
    [email protected]

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "es6",
      "dom"
    ],
    "module": "commonjs",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "sourceMap": true
  },
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "angularCompilerOptions": {
    "genDir": "aot",
    "skipMetadataEmit": true
  }
}

My question, then, is this:

Is there a linter, or some debugger log that I am not seeing that would aid in troubleshooting? I recognize that some IDE's would highlight these errors (especially the missing SCSS file) but that doesn't answer my question.

Thanks in advance!

1 Answer 1

1

I'm not sure what your problem is, but in all cases you mentioned with default compiler settings I get errors. The following snippet:

import style    from './bla'; // with bla.js being an empty file

export const foo = {
  propA: 'abc',
  propB: 123;
  propc: 'value'
}

function _functionName( param1: string, param2: boolean; param3: string ): void {}

Produces the following output:

test.ts(5,13): error TS1005: ',' expected.
test.ts(10,56): error TS1005: ',' expected.

While the empty module does not produce a compiler error it does warn you about this in VS Code.

If you want a linter for Typescript, tslint is a great tool. But your first two are definitely compiler errors (at least with TS 2.5)

Sign up to request clarification or add additional context in comments.

1 Comment

Let's focus on these one at a time and see if they're environmental or if it's in a specific place. For example, the last one: the specific place where this fails on mine is assigning a private method to an Angular service. I can reproduce this at will. I'll edit my response to include version information and see if I can put a small project together that reproduces.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.