DanWahlin / Angular-JumpStart

Angular and TypeScript JumpStart example application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

running deno

andlez opened this issue · comments

Thank you for this perfect tutorial !

I tries to run Angular-JumpStart with deno and got errors. How I could correct errors ? Than you in advance.

ERRORS:

Check file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/server.ts
error: TS2344 [ERROR]: Type '{ skip: string; top: string; }' does not satisfy the constraint 'string'.
router.get<{skip: string, top: string}>('/api/customers/page/:skip/:top', (ctx) => {
~~~~~~~~~~~~~~~~~~~~~~~~~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:8:12

TS7006 [ERROR]: Parameter 'ctx' implicitly has an 'any' type.
router.get<{skip: string, top: string}>('/api/customers/page/:skip/:top', (ctx) => {
~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:8:76

TS2344 [ERROR]: Type '{ id: string; }' does not satisfy the constraint 'string'.
router.get<{id: string}>('/api/customers/:id', (ctx) => {
~~~~~~~~~~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:29:12

TS7006 [ERROR]: Parameter 'ctx' implicitly has an 'any' type.
router.get<{id: string}>('/api/customers/:id', (ctx) => {
~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:29:49

TS2532 [ERROR]: Object is possibly 'undefined'.
postedCustomer.id = ++maxId;
~~~~~~~~~~~~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:46:5

TS2339 [ERROR]: Property 'id' does not exist on type 'Promise | Promise | Promise | FormDataReader | Promise'.
Property 'id' does not exist on type 'Promise'.
postedCustomer.id = ++maxId;
~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:46:20

TS2532 [ERROR]: Object is possibly 'undefined'.
postedCustomer.gender = (postedCustomer.id % 2 === 0) ? 'female' : 'male';
~~~~~~~~~~~~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:47:5

TS2339 [ERROR]: Property 'gender' does not exist on type 'Promise | Promise | Promise | FormDataReader | Promise'.
Property 'gender' does not exist on type 'Promise'.
postedCustomer.gender = (postedCustomer.id % 2 === 0) ? 'female' : 'male';
~~~~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:47:20

TS2532 [ERROR]: Object is possibly 'undefined'.
postedCustomer.gender = (postedCustomer.id % 2 === 0) ? 'female' : 'male';
~~~~~~~~~~~~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:47:30

TS2339 [ERROR]: Property 'id' does not exist on type 'Promise | Promise | Promise | FormDataReader | Promise'.
Property 'id' does not exist on type 'Promise'.
postedCustomer.gender = (postedCustomer.id % 2 === 0) ? 'female' : 'male';
~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:47:45

TS2344 [ERROR]: Type '{ id: string; }' does not satisfy the constraint 'string'.
router.put<{id: string}>('/api/customers/:id', async (ctx) => {
~~~~~~~~~~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:52:12

TS7006 [ERROR]: Parameter 'ctx' implicitly has an 'any' type.
router.put<{id: string}>('/api/customers/:id', async (ctx) => {
~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:52:55

TS2344 [ERROR]: Type '{ id: string; }' does not satisfy the constraint 'string'.
router.delete<{id: string}>('/api/customers/:id', (ctx) => {
~~~~~~~~~~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:75:15

TS7006 [ERROR]: Parameter 'ctx' implicitly has an 'any' type.
router.delete<{id: string}>('/api/customers/:id', (ctx) => {
~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:75:52

TS2344 [ERROR]: Type '{ id: string; }' does not satisfy the constraint 'string'.
router.get<{id: string}>('/api/orders/:id', (ctx) => {
~~~~~~~~~~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:86:12

TS7006 [ERROR]: Parameter 'ctx' implicitly has an 'any' type.
router.get<{id: string}>('/api/orders/:id', (ctx) => {
~~~
at file:///mnt/c/ANGULAR_PROJECTS/SOURCE/ANGULAR_JUMPSTART/Angular-JumpStart/deno/routes.ts:86:46

Found 16 errors.

I just updated the project to Angular 13 which adds strict typing which I suspect is causing the errors with Deno. I'd like to update that at some point but for now I'll have to recommend that you run the Node option instead.

As a quick update, I took a look to see if there was something Oak changed (the Deno server that's used) and it was a simple fix to get that going fortunately. I just pushed the latest updates that seem to work OK now if you want to try it.