Skip to content

Error TS1005 on Exercise 15 from Beginner's guide #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fffjacquier opened this issue Nov 22, 2022 · 1 comment
Closed

Error TS1005 on Exercise 15 from Beginner's guide #64

fffjacquier opened this issue Nov 22, 2022 · 1 comment

Comments

@fffjacquier
Copy link

👋 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?

@fffjacquier
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant