total-typescript/beginners-typescript-tutorial

Error TS1005 on Exercise 15 from Beginner's guide

fffjacquier opened this issue ยท 1 comments

๐Ÿ‘‹ Hello,

On this page https://www.totaltypescript.com/tutorials/beginners-typescript/combining-types-to-create-new-types/solution
if I use as suggested at the end

type UserAndPosts = (): User & { posts: Post[] }

export const getDefaultUserAndPosts = (): UserAndPosts => {

instead of
export const getDefaultUserAndPosts = (): User & { posts: Post[] } => {

I got errors: src/15-intersection.problem.ts:16:23 - error TS1005: '=>' expected.

What is wrong with it?

Found it, should use
type UserAndPosts = User & { posts: Post[] }