tflori / angular-translator

translation module for angular
https://tflori.github.io/angular-translator/
MIT License
21 stars 6 forks source link

tsc complains about types #8

Closed Quinten closed 7 years ago

Quinten commented 7 years ago

There are some type errors when running tsc in our project after installing your module:

node_modules/angular2-translator/angular2-translator/TranslateConfig.ts(50,13): error TS7005: Variable 'p' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateConfig.ts(52,39): error TS7006: Parameter 'languageString' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateConfig.ts(59,27): error TS7006: Parameter 'substring' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateConfig.ts(59,38): error TS7006: Parameter 'language' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateLoaderJson.ts(56,63): error TS7006: Parameter 'v' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateService.ts(53,13): error TS7006: Parameter 'observer' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateService.ts(176,13): error TS7005: Variable 'result' implicitly has an 'any[]' type.
node_modules/angular2-translator/angular2-translator/TranslateService.ts(242,13): error TS7005: Variable 'varName' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateService.ts(318,13): error TS7005: Variable 'j' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateService.ts(320,13): error TS7005: Variable 'key' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateService.ts(322,13): error TS7005: Variable 'paramKey' implicitly has an 'any' type.
node_modules/angular2-translator/angular2-translator/TranslateService.ts(323,13): error TS7005: Variable 'getter' implicitly has an 'any' type.

No other problems with your module. Besides these errors it seems to work fine. Any idea how to fix this? Because it is making the output of tsc harder to read...

tflori commented 7 years ago

I will check if I can fix this but it's just some warnings

tflori commented 7 years ago

I hope this helps 1.3.1 will be created when CI is finished

Quinten commented 7 years ago

Thank you! Looking forward to it :)

Quinten commented 7 years ago

Sorry to bump in again.

I pulled 1.3.1 from npm. All the tsc warnings are gone but in the browser i get:

(SystemJS) angular2_translator_1.TranslateConfig is not a constructor
tflori commented 7 years ago

hm that is weird. does it still work or is the package broken? do you have a trace?

I will have a look in the evening. The tests didn't show this error..

tflori commented 7 years ago

hey, I just realized the bundle is not working for me - you have the same problem? also the .d.ts file was missing.

I changed my systemjs.config.js not to use the bundle and added the .d.ts file manually - now I don't get the error you get.

Can you please provide more information about the error you get? Angular, SystemJs, Typescript and Browser version and may be a backtrace

tflori commented 7 years ago

the bundle did not work but after updating and fixing the bundle I don't get this error. There was one version where I got the same error but it seems to be problem of systemjs-builder or another bundler in your case...

Quinten commented 7 years ago

The complete trace is:

TypeError: angular2_translator_1.TranslateConfig is not a constructor
at eval (http://local.box.dev/website/static/js/src/app/app.module.js:54:77)
at Object.eval (http://local.box.dev/website/static/js/src/app/app.module.js:64:2)
at eval (http://local.box.dev/website/static/js/src/app/app.module.js:67:4)
at eval (http://local.box.dev/website/static/js/src/app/app.module.js:68:3)
at eval (<anonymous>)
at SystemJSLoader.__exec (http://local.box.dev/website/static/js/dist/app.min.js?1488625046:6:122)
at entry.execute (http://local.box.dev/website/static/js/dist/app.min.js?1488625046:7:10551)
at linkDynamicModule (http://local.box.dev/website/static/js/dist/app.min.js?1488625046:6:26455)
at getModule (http://local.box.dev/website/static/js/dist/app.min.js?1488625046:6:25846)
at http://local.box.dev/website/static/js/dist/app.min.js?1488625046:6:26554
at require (http://local.box.dev/website/static/js/dist/app.min.js?1488625046:7:9682)
at Object.eval (http://local.box.dev/website/static/js/src/main.js:4:20)
at eval (http://local.box.dev/website/static/js/src/main.js:8:4)
at eval (http://local.box.dev/website/static/js/src/main.js:9:3)
at eval (<anonymous>)

Angular 2.4.0 systemjs 0.19.40 typescript 2.0.10 Chrome 56.0.2924.87

Quinten commented 7 years ago

Also when i run 'npm install' in node_modules/angular2-translator it cannot find the node_modules/angular2-translator/bundle.js

tflori commented 7 years ago

the correct path is node_modules/angular2-translator/bundles/angular2-translator.js

tflori commented 7 years ago

which version of systemsjs you are using?

Quinten commented 7 years ago

I use systemjs 0.19.40

Quinten commented 7 years ago

It doesn't matter if i load it from /node_modules/angular2-translator/bundles/angular2-translator.js instead of /website/static/js/lib/npm/angular2-translator/bundles/angular2-translator.js still same error

tflori commented 7 years ago

It's a problem with the bundle in this version. 1.3.1 is broken everything is undefined. I will publish 1.3.2 where bundle is fixed

tflori commented 7 years ago

I will close this issue - If you have still problems with 1.3.2 feel free to reopen

Quinten commented 7 years ago

Installed 1.3.2 from npm and all is fine now :) Thank you