What is the difference between declare global in the Typescript declaration file and normal declare?

problem description

  1. ordinary declare

    declare  function hello1(s: string):void;
  2. declare global

    declare global {
        function  hello2(s: string):void
    }

declare any of the above in the declaration file xxx.d.ts , hello1/hello2,
can be detected and accessed globally, so what is the difference between the two declaration methods?
is mainly declare global how should I use it? I can"t find this usage in the official documents


https://www.typescriptlang.or.
Global augmentation, at the end


xxx.d.ts

xxx.ts

whether your file name is the same, change it to a different one. For example,

xxx.d.ts

yyy.ts


Global augmentations have the same behavior and limits as module augmentations.
Global declare is the same as declare


in the d.ts declaration file, any declare is global by default, so you can't have declare global in the d.ts file. Only the definition is in the module file. If you want global, use declare global

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be9007-39cee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be9007-39cee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?