Comments (5)
can you also post your package.json?
from js-restful-express.
Here it is:
{
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"body-parser": "^1.15.2",
"core-js": "^2.4.1",
"express": "^4.14.0",
"js-restful-express": "^2.0.0",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/compiler-cli": "^2.3.1",
"@types/body-parser": "0.0.33",
"@types/chai": "^3.4.34",
"@types/chai-http": "0.0.29",
"@types/core-js": "^0.9.35",
"@types/express": "^4.0.34",
"@types/jasmine": "2.5.38",
"@types/mocha": "^2.2.35",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.24",
"chai": "^3.5.0",
"chai-http": "^3.0.0",
"codelyzer": "~2.0.0-beta.1",
"concurrently": "^3.1.0",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"mocha": "^3.2.0",
"protractor": "~4.0.13",
"ts-node": "^1.2.1",
"tslint": "^4.0.2",
"typescript": "~2.0.3"
}
}
from js-restful-express.
core-js is fine. it provides a reflect implementation. "Make sure you have a shim for es7 reflect" just means I don't want to require a specific reflect implementation.
here is a tsconfig that works for me if I install "@types/reflect-metadata" to get the required typings. core-js wasn't sufficient.
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"lib": ["es6", "es2015", "dom"],
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"declaration": true,
"typeRoots": [
"node_modules/@types"
],
"types": [
"node",
"reflect-metadata"
]
}
}
from js-restful-express.
Hello there! An error leading to another, I've finnaly manage to get a stable app using your library. Here is what I've added:
tsconfig:
{
"compilerOptions": {
"experimentalDecorators": true,
"types": [ ],
"target": "es5" <-- added this
}
}
In my ping.router.ts:
import 'reflect-metadata'; // first install it using npm
Without this import, I have to deal with the following error:
ReferenceError: Reflect is not defined
With this import, it seems that I don't need to use types
and typeRoots
in tsconfig... So I removed them (include types does not prevent the error above anyway).
Lastly, I need to install (but not import... 😕 ) the @types/winston
dependency to prevent error TS2307: Cannot find module 'winston'
Two main concerns with this solution:
- Why do I need to install
@types/winston
when I don't even usewinston
myself? - Why do I need to import
reflect-metadata
each time I want to use a decorator? I've tried to import it inindex.ts
(my main server file) buttsc
throws anReflect not defined
error.
Thanks a lot for your help!
from js-restful-express.
Why do I need to install @types/winston when I don't even use winston myself?
Because this package includes all sources and it's own tsconfig.json.
Why do I need to import reflect-metadata each time I want to use a decorator? I've tried to import it in index.ts (my main server file) but tsc throws an Reflect not definederror
you need to make sure that reflect-metadata is included once. And you need to tell typescript about the type @types/reflect-metadata.
from js-restful-express.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-restful-express.