rapidjs / rapid.js

An ORM-like Interface and a Router For Your API Requests
https://rapidjs.drewjbartlett.com
711 stars 45 forks source link

Properly declare and import type definitions #41

Open mgred opened 6 years ago

mgred commented 6 years ago

Run tsc -p .

tsconfig.json(49,5): error TS5023: Unknown compiler option 'esModuleInterop'.
src/auth.ts(36,33): error TS2339: Property 'auth' does not exist on type 'Config'.
src/auth.ts(36,65): error TS2339: Property 'auth' does not exist on type 'Config'.
src/auth.ts(41,33): error TS2339: Property 'auth' does not exist on type 'Config'.
src/auth.ts(41,66): error TS2339: Property 'auth' does not exist on type 'Config'.
src/auth.ts(46,33): error TS2339: Property 'auth' does not exist on type 'Config'.
src/auth.ts(46,64): error TS2339: Property 'auth' does not exist on type 'Config'.
src/auth.ts(51,33): error TS2339: Property 'auth' does not exist on type 'Config'.
src/auth.ts(51,68): error TS2339: Property 'auth' does not exist on type 'Config'.
src/auth.ts(55,24): error TS2339: Property 'auth' does not exist on type 'Config'.
src/core/core.ts(77,60): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Route'.
src/core/core.ts(133,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
src/core/custom-route.ts(4,10): error TS2339: Property 'route' does not exist on type 'CustomRoute'.
src/core/custom-route.ts(11,10): error TS2339: Property 'config' does not exist on type 'CustomRoute'.
src/core/custom-route.ts(25,51): error TS2339: Property 'config' does not exist on type 'CustomRoute'.
src/core/custom-route.ts(28,46): error TS2339: Property 'config' does not exist on type 'CustomRoute'.
src/core/custom-route.ts(70,17): error TS2339: Property 'route' does not exist on type 'CustomRoute'.
src/core/custom-route.ts(79,17): error TS2339: Property 'route' does not exist on type 'CustomRoute'.
src/core/custom-route.ts(88,17): error TS2339: Property 'route' does not exist on type 'CustomRoute'.
src/core/request.ts(26,49): error TS2339: Property 'globalParameters' does not exist on type 'Config'.
src/core/request.ts(30,15): error TS2339: Property 'params' does not exist on type 'object'.
src/core/request.ts(30,57): error TS2339: Property 'globalParameters' does not exist on type 'Config'.
src/core/request.ts(45,5): error TS2322: Type 'string' is not assignable to type 'RequestType'.
src/core/request.ts(79,22): error TS2339: Property 'allowedRequestTypes' does not exist on type 'Config'.
src/core/request.ts(81,80): error TS2339: Property 'allowedRequestTypes' does not exist on type 'Config'.
src/core/request.ts(241,24): error TS2339: Property 'beforeRequest' does not exist on type 'Config'.
src/core/request.ts(251,17): error TS2339: Property 'afterRequest' does not exist on type 'Config'.
src/core/request.ts(261,17): error TS2339: Property 'onError' does not exist on type 'Config'.
src/core/url.ts(4,8): error TS6133: 'store' is declared but its value is never read.
src/core/url.ts(4,19): error TS2307: Cannot find module '../store/index'.
src/core/url.ts(28,21): error TS2339: Property 'extension' does not exist on type 'Config'.
src/core/url.ts(29,30): error TS2339: Property 'extension' does not exist on type 'Config'.
src/debug/debugger.ts(5,10): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(6,10): error TS2339: Property 'data' does not exist on type 'default'.
src/debug/debugger.ts(7,10): error TS2339: Property 'logEnabled' does not exist on type 'default'.
src/debug/debugger.ts(11,25): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(14,5): error TS2556: Expected 2-4 arguments, but got a minimum of 0.
src/debug/debugger.ts(16,14): error TS2339: Property 'logEnabled' does not exist on type 'default'.
src/debug/debugger.ts(17,12): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(17,40): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(18,12): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(21,10): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(30,22): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(30,47): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(32,32): error TS2339: Property 'params' does not exist on type '{}'.
src/debug/debugger.ts(35,22): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(35,47): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(38,20): error TS2339: Property 'caller' does not exist on type 'default'.
src/debug/debugger.ts(40,10): error TS2339: Property 'data' does not exist on type 'default'.
src/debug/debugger.ts(46,10): error TS2339: Property 'data' does not exist on type 'default'.
src/rapid.ts(4,1): error TS2304: Cannot find name 'module'.
src/rapid.ts(5,1): error TS2304: Cannot find name 'module'.
src/rapid.ts(6,1): error TS2304: Cannot find name 'module'.
mgred commented 6 years ago

@drewjbartlett, @yihou I would start fixing these errors

mgred commented 6 years ago

https://github.com/mgred/rapid.js/tree/rapid.js-41

mgred commented 6 years ago

I refactored so far to get rid of the typings directory.

drewjbartlett commented 6 years ago

@mgred you are the man thank you! Sorry for the delay. Just got back from a trip. Will have a look at this asap!

drewjbartlett commented 6 years ago

@mgred I know it has been forever since I have followed up with this -- finally had a moment to dive in here and honestly I am just a little lost on how I can get my tests to start passing. Do you have any thoughts?

drewjbartlett commented 6 years ago
screen shot 2018-05-18 at 11 14 36 am screen shot 2018-05-18 at 11 14 58 am

@mgred That is the test file, that is the output. As soon as I add the line for Core, it stops working. This is what is holding me up from finishing this :(

mgred commented 6 years ago

@drewjbartlett I'm on a trip currently and will have look this evening.

drewjbartlett commented 6 years ago

@mgred no worrries/rush at all :D

mgred commented 6 years ago

@drewjbartlett I switched to my branch rapidjs-41 where I made some refactorings. The test passes more or less but the promise seems not be handled correctly. test I still don't know why it's not working on our main refactoring branch v2-refactor, but I will investigate. Maybe It's just some setting in the tsconfig.json which also used by Jest.

drewjbartlett commented 6 years ago

ah that would make sense! That's good news you can get it working partially! I really appreciate all the help @mgred

drewjbartlett commented 6 years ago

@mgred I have been thinking a bit and I need to be able to easily test this. TS is not allowing me to do this easily. If I can't get this figured out soon the reality is that v2 will not happen. I am feeling a little discouraged at committing fully to TS before fully understanding it and getting a solid workflow in place.

I appreciate all the work everyone is putting in but I just can't get caught up in the build tools, etc. Lemme know if you have any suggestions :)

mgred commented 6 years ago

@drewjbartlett I still try to figure out why the tests are not running on the main refactoring branch, I updated the tsconfig.json to be like the one on my branch rapid.js-41

{
"module" : "commonjs",
"noEmit": false
}

but still it shows the same error. I will give you the MR for this issue/branch. You can then continue with a working build and test environment as far as I can say

mgred commented 6 years ago

45