Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Build not working in Typescript #1761

Open
incompletude opened this issue Apr 15, 2021 · 3 comments
Open

Build not working in Typescript #1761

incompletude opened this issue Apr 15, 2021 · 3 comments

Comments

@incompletude
Copy link

incompletude commented Apr 15, 2021

First-time Svelte user.

Tried to follow the docs for a typescript project, and it doesn't work. Multiple warnings on build, multiple warning and errors on run.

TS2769: No overload matches this call.
  Overload 1 of 2, '(pattern: string | RegExp, ...handlers: (Polka<Request> | Middleware<Request>)[]): Polka<Request>', gave the following error.
    Argument of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to parameter of type 'string | RegExp'.
      Type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is missing the following properties from type 'RegExp': exec, test, source, global, and 12 more.

Come on guys, I understand Sapper is in early development, and some things may change before we hit version 1.0. , but the very Getting started must work.

Also, linting should be available out of the box.

@philippone
Copy link

Hi,

I did the following changes to src/server.ts and at least it's compiling without errors.

polka() // You can also use Express
	.use(
		// compression({ threshold: 0 }),
		sirv('static', { dev }),
		sapper.middleware()
	)
	// .listen(PORT, err => {
		// 	if (err) console.log('error', err);
		// });
		.listen(PORT);

Not sure what I removed actually.

@incompletude
Copy link
Author

incompletude commented Apr 15, 2021

I just dropped the idea of using Stelve/Sapper. Not mature enough. Thx anyway.

@Oliver-Piorun
Copy link

Hi! The issue seems to be related to polka. Version 1.0.0-next.11 works just fine, 1.0.0-next.12 breaks it.

The newer version introduced typings for use and listen which are not compatible with the template anymore:
lukeed/polka@v1.0.0-next.11...v1.0.0-next.12#diff-c1a30fcb84e4afba40aece7b061bcd4223a94bdf8465e4b341e4700cdae53d66R48

Current solution: Stick to 1.0.0-next.11. Further investigation is required ;-)

Greetings! :)

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants