sholladay / pogo

Server framework for Deno
Mozilla Public License 2.0
482 stars 33 forks source link

Cannot work example (hello-world) on Deno 0.36.0 #12

Closed horihiro closed 4 years ago

horihiro commented 4 years ago

I tried to run the following hello world example on Deno 0.36.0. https://github.com/sholladay/pogo/blob/master/example/hello-world/run.ts

But I got many errors...

Could you please look into this?

Regards,

$ deno run --allow-net --reload /PATH/TO/helloworld.ts
Compile file://PATH/TO/helloworld.ts
Download https://deno.land/x/pogo/main.ts
Download https://deno.land/x/pogo/lib/router.ts
Download https://deno.land/x/pogo/lib/server.ts
Download https://deno.land/x/pogo/dependencies.ts
Download https://deno.land/x/pogo/lib/bang.ts
Download https://deno.land/x/pogo/lib/respond.ts
Download https://deno.land/x/pogo/lib/request.ts
Download https://deno.land/x/pogo/lib/toolkit.ts
Download https://deno.land/std@v0.35.0/http/cookie.ts
Download https://deno.land/std@v0.35.0/http/server.ts
Download https://deno.land/std@v0.35.0/http/http_status.ts
Download https://dev.jspm.io/react@16.12.0
Download https://dev.jspm.io/react-dom@16.12.0/server
Download https://deno.land/std@v0.35.0/testing/asserts.ts
Download https://deno.land/std@v0.35.0/datetime/mod.ts
Download https://deno.land/std@v0.35.0/io/bufio.ts
Download https://deno.land/std@v0.35.0/util/async.ts
Download https://deno.land/std@v0.35.0/http/io.ts
Download https://deno.land/std@v0.35.0/strings/mod.ts
Download https://deno.land/std@v0.35.0/io/util.ts
Download https://deno.land/std@v0.35.0/path/mod.ts
Download https://deno.land/std@v0.35.0/path/win32.ts
Download https://deno.land/std@v0.35.0/path/posix.ts
Download https://deno.land/std@v0.35.0/path/constants.ts
Download https://deno.land/std@v0.35.0/path/constants.ts
Download https://deno.land/std@v0.35.0/path/interface.ts
Download https://deno.land/std@v0.35.0/path/glob.ts
Download https://deno.land/std@v0.35.0/path/globrex.ts
Download https://deno.land/std@v0.35.0/path/utils.ts
Download https://deno.land/std@v0.35.0/fmt/colors.ts
Download https://deno.land/std@v0.35.0/testing/diff.ts
Download https://deno.land/std@v0.35.0/testing/format.ts
Download https://deno.land/std@v0.35.0/strings/encode.ts
Download https://deno.land/std@v0.35.0/strings/decode.ts
Download https://deno.land/std@v0.35.0/strings/pad.ts
Download https://deno.land/std@v0.35.0/textproto/mod.ts
Download https://deno.land/x/pogo/lib/response.ts
error TS2339: Property 'next' does not exist on type 'Listener'.

► https://deno.land/std@v0.35.0/http/server.ts:201:49

201     const { value, done } = await this.listener.next();
                                                    ~~~~

error TS7006: Parameter 'message' implicitly has an 'any' type.

► https://deno.land/x/pogo/lib/bang.ts:5:17

5     constructor(message, option = {}) {
                  ~~~~~~~

  :

Found 179 errors.
sholladay commented 4 years ago

I am in the process of transitioning to TypeScript on master. Generally, I keep master in working order, but it's indeed broken at the moment.

For now, you should use the latest tagged release. Meaning, you should include the version in the path and use run.js instead of run.ts.

Or if you are making a script, then instead of inport pogo from 'https://deno.land/x/pogo/main.ts', you should use inport pogo from 'https://deno.land/x/pogo@v0.3.0/main.js'.

sholladay commented 4 years ago

I fixed this by removing the TypeScript changes from master. Will re-introduce them later via a PR when it's working properly. For now, you should use .js / .jsx files to import Pogo. On older versions of Deno, you can use .ts / .tsx, but Deno's TypeScript config is stricter in recent versions and it breaks.

Let me know if you continue to have any problems. If it's not working and you are importing Pogo from a local file, you likely need to use Deno's --reload flag once to download the latest dependencies that include the fix.