Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !9011

docs(typescript): add note on global.d.ts for ambient modules

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/daceynolan/typescript-ambiet-modules-docs into main May 14, 2020
  • Overview 13
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: daceynolan

This PR includes a documentation update to note that the src/global.d.ts is recognized by default for type declarations.

Added to the docs so others that come across this find the solution in the official docs.


While working with TypeScript and create-react-app, I ran into a scenario where I needed to declare an ambient module. I created a src/types.d.ts file to declare my module only to find out that the file is not recognized.

Through my research, I found this issue: https://github.com/facebook/create-react-app/issues/6553

The suggestion was to modify the tsconfig which didn't seem like a great solution.

Found this thread: https://stackoverflow.com/questions/54949876/create-react-app-typescript-does-not-load-d-ts-file

That thread recommended using a src/global.d.ts file which solved my problem.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/daceynolan/typescript-ambiet-modules-docs