Failing to build from example
psychemedia opened this issue · 2 comments
Hi
I'm a complete typescript novice and was trying to rebuild a working blog from this repo to explore using the sqlite components.
After installing TypeScript (npm install typescript
) I tried the yarn build
command but it failed on:
client/pages/index.tsx:3:21 - error TS2307: Cannot find module '../../posts-built/summary.json' or its corresponding type declarations.
Chasing dow the errors, I created an empty posts-built/summary.json
file, then one with the contents {"posts":[]}
, but it still wants more; does a schema, or some such, for that object need defining somewhere to be able to run the build?
Hey!
as a disclaimer: This repo isn't really made for public usage so I probably won't really add good documentation or really support working on it. You're probably better off using the sqlite repo directly and building your own simple UI.
You should not npm install typescript
, instead you should run yarn install
to install all dependencies. The summary.json file should be built by doing yarn posts
which should automatically run as part of yarn build
(see package.json)
Thanks... I appreciate that it isn't really a "public" repo - I was just trying to find a quick way over a coffee break to set up trying out your sqlite components as a sketch to demonstrate how interactive sqlite queries could be embedded, executed and response displayed in a web page.
I still seem to get some unresolved issues - I guess I need to put a bit more time aside to get a better understanding of all the frameworks involved. I love the SQLite demos, btw:-)
client/pages/index.tsx:16:32 - error TS2345: Argument of type '{ posts: ({ filename: string; frontmatter: { csl: string; date: string; references: never[]; title: string; updated: string; "url2cite-link-output": string; author?: undefined; "link-citations"?: undefined; ... 4 more ...; subtitle?: undefined; }; preview: string; } | ... 4 more ... | { ...; })[]; }' is not assignable to parameter of type 'Summary'.
Types of property 'posts' are incompatible.
Type '({ filename: string; frontmatter: { csl: string; date: string; references: never[]; title: string; updated: string; "url2cite-link-output": string; author?: undefined; "link-citations"?: undefined; url2cite?: undefined; "url2cite-cache"?: undefined; urlcolor?: undefined; hidden?: undefined; subtitle?: undefined; }; ...' is not assignable to type 'PostSummary[]'.
Type '{ filename: string; frontmatter: { csl: string; date: string; references: never[]; title: string; updated: string; "url2cite-link-output": string; author?: undefined; "link-citations"?: undefined; url2cite?: undefined; "url2cite-cache"?: undefined; urlcolor?: undefined; hidden?: undefined; subtitle?: undefined; }; p...' is not assignable to type 'PostSummary'.
Type '{ filename: string; frontmatter: { csl: string; hidden: boolean; references: never[]; "url2cite-link-output": string; date?: undefined; title?: undefined; updated?: undefined; author?: undefined; "link-citations"?: undefined; url2cite?: undefined; "url2cite-cache"?: undefined; urlcolor?: undefined; subtitle?: undefi...' is not assignable to type 'PostSummary'.
The types of 'frontmatter.title' are incompatible between these types.
Type 'undefined' is not assignable to type 'string'.
16 const postList = filterPosts(summary)
~~~~~~~
server/build-feed.ts:19:3 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
19 title: post.frontmatter.title,
~~~~~
node_modules/feed/lib/typings/index.d.ts:2:5
2 title: string;
~~~~~
The expected type comes from property 'title' which is declared here on type 'Item'
server/build-feed.ts:20:18 - error TS2769: No overload matches this call.
Overload 1 of 4, '(value: string | number | Date): Date', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string | number | Date'.
Type 'undefined' is not assignable to type 'string | number | Date'.
Overload 2 of 4, '(value: string | number): Date', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string | number'.
Type 'undefined' is not assignable to type 'string | number'.
20 date: new Date(post.frontmatter.date),