0

If I have a namespace in global.d.ts with a function inside:

declare namespace MY_NAMESPACE {
  function doSomething(): void
}

How can I describe that function then?

2
  • What exactly do you mean by "describe"? Commented Jul 11, 2022 at 23:44
  • Describe the body of the function Commented Jul 11, 2022 at 23:45

1 Answer 1

4

The purpose of a d.ts file isn't to create a runnable function. It is only used to describe the types of a module that does not have any.

For example: Module A is a pure JavaScript package, but you want to use it strongly typed in your TypeScript project. If that is the case, you write a d.ts file for that module.

TypeScript Documentation: Modules .d.ts

Sign up to request clarification or add additional context in comments.

1 Comment

I thought it was possible since VSCode wasn`t warning of defining a function. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.