Custom_typings and environment folder is missing

Hi!
I´m trying to learn some basic Aurelia from this tutorial:

The tutorial refer to folders and files that is not in the project, custom_typings and environment folder(dev.ts). These files are missing.
How to handle an api key when i cant put it in dev.ts?
Where do i put the ts typings for de moviedb-promise when ther is no custom_typings folder.
Thanks for the help!

Hey there. This article is quite old (2018) and default structure of projects has changed meanwhile a bit.

With regards to the env file, you’ll find these located in your /config folder named environment.json (dev) and environment.production.json (prod). So just put the apiKey in there.

When it comes to custom typings, for your specific use case with moviedb-promise I think it’s no longer needed as the dependency ships with it’s own typings now by default.
But anyways if you’re going to need custom typings do the following:

  • create a folder custom_typings in the root of your project
  • For the sake of a test create a file moviedb-promise.d.ts
  • Just to test out make it’s content now:
declare module 'moviedb-promise' {

  export function Foobar();

}
  • modify your tsconfig.json
"typeRoots": [
 "custom_typings",  <----------- add this
 "./node_modules/@types"
],
...
"include": [
 "src",
 "test",
 "custom_typings"  <------ add this
],

now when importing from moviedb-promise you should see your fake Foobar function from above

import { Foobar } from "moviedb-promise";`

but as said, for the concrete case, I think you can skip the custom typings for that dependency alltogether.

3 Likes

Thanks for a very clear and pedagogical post!

I have found it hard to find up to date Aurelia ts tutorials…

Thanks again and have a nice week!

1 Like

Have you checked out the official docs?

If yes, did you felt there was something missing, or wished concepts were more explained?

Here are real world examples
https://docs.aurelia.io/tutorials/create-a-dashboard-using-dynamic-composition?