Using TS I get "Uncaught SyntaxError: Unexpected token :"

I have to reset my meteor project every two saves. It makes it very difficult to program and slows me down drastically.

I saw another post with the “Uncaught SyntaxError: Unexpected token import” error. Since I’m writing in ts I don’t know that this applies.

Any ideas.

Why?

I have no idea. I’m new to Meteor so I may be doing something very wrong. So as I’m working in a component. It appears that every two saves or a few more the component in the client stops working and I get the “Uncaught SyntaxError: Unexpected token :”.

As I step through the generated JavaScript there is a “:” in the line. So I don’t know if meteor is not compiling to JS correctly or what. Let me generate an error and see if I can get a screen shot.

Here is a screenshot of Chrome. It appears that the meteor engine did not fully render to JavaScript.

At this point I have to do the following:
c> meteor reset
c> meteor

Then it works fine. This is very annoying. I would not mind exposing my source code.

So, what does the typescript look like for that section of code?

  // ** Subscribe to the searchByCustomerID
  me.searchService.getCurrentCustomer().subscribe((resultItem: CustomerSearchResultItem) => {
  	this.buildCustomerCard(resultItem);
  });

Hmm. Is this a Meteor subscribe or something else?

Here is the definition of that method. I’m using “rxjs/Rx”.

	public getCurrentCustomer():Observable<CustomerSearchResultItem> { 
		return this.subject.asObservable();
	}

I must be doing something terribly wrong since the more I code the more these errors pop up. This is one of them. There are two more that appear … I will post them here as soon as they appear again.

Okay, outside of my understanding, sorry. It looks like correct TS and incorrect JS, in which case there may be a bug in the transpiler.

I’m really concerned because I’m building a CRM and there are a lot more screens I have to build. So I’m wondering if there is something that I should be doing different in my TS code that would prevent and help the transpiler.
I would be willing to share this code. It is on BitBucket. The API’s are housed on Azure so it would be a minimal effort for you guys to look at it.

Which version of TypeScript are you using and how are you plugging it into Meteor?

I’m running on Windows. Honestly I don’t know I started a meteor project in TS. Started from a tutorial. If I send you my package.json would it help?

{
  "name": "angular2-meteor-base",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "meteor test --driver-package practicalmeteor:mocha",
    "test:ci": "meteor test --once --driver-package dispatch:mocha-phantomjs"
  },
  "devDependencies": {
    "@types/chai": "^3.4.33",
    "@types/mocha": "^2.2.32",
    "chai": "3.5.0",
    "chai-spies": "0.7.1"
  },
  "dependencies": {
    "@angular/common": "2.1.1",
    "@angular/compiler": "2.1.1",
    "@angular/core": "2.1.1",
    "@angular/forms": "2.1.1",
    "@angular/http": "2.1.1",
    "@angular/platform-browser": "2.1.1",
    "@angular/platform-browser-dynamic": "2.1.1",
    "@angular/router": "3.1.1",
    "angular2-meteor": "0.7.0",
    "angular2-meteor-polyfills": "0.1.1",
    "angular2-meteor-tests-polyfills": "0.0.2",
    "angular2-modal": "^2.0.2",
    "angular2-text-mask": "^2.1.0",
    "babel-runtime": "^6.18.0",
    "bootstrap": "^4.0.0-alpha.3",
    "meteor-node-stubs": "0.2.3",
    "meteor-rxjs": "0.4.0",
    "meteor-typings": "1.3.1",
    "reflect-metadata": "0.1.8",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26"
  }
}

I don’t see any TS on there.

What do you have in your .meteor\packages file?

Indeed. To actually use TypeScript you need to plug that in somewhere. That’s usually done through the barbatus:typescript package.