Skip to content

Conversation

jeremy-ebinum
Copy link
Contributor

@jeremy-ebinum jeremy-ebinum commented Apr 5, 2020

While doing exercise 9.16 I ran into a problem extending a typescript interface with a new property.

I had a flat directory "data" with contents:

├── patients.json
└── patients.ts

and tried to import the patients.ts file but I hadn't realized earlier that because I set resolveJsonModule to true in tsconfig.json, patients.json would now be included in node module resolution.

So while trying to:

import patients from "./data/patients"

Typescript kept compiling the patients.json file instead of patients.ts so my new object with supposed new properties was using stale data from the .json file and with type assertions it was difficult to track down the exact problem.

I made an edit to the English version of part9c that includes a warning about this behavior.

Added a topic to warn student about pitfalls of requiring modules with
the same filename but different extensions
@mluukkai
Copy link
Contributor

mluukkai commented Apr 5, 2020

👍

@mluukkai mluukkai merged commit 4fb444e into fullstack-hy2020:source Apr 5, 2020
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

Successfully merging this pull request may close these issues.

2 participants