排序

❌不要将更一般的重载放在更具体的重载之前:

Don't put more general overloads before more specific overloads:

/* WRONG */
declare function fn(x: unknown): unknown;
declare function fn(x: HTMLElement): number;
declare function fn(x: HTMLDivElement): string;

var myElem: HTMLDivElement;
var x = fn(myElem); // x: unknown, wat?

2JF3MKOHEBViPCKK8p74kx2CWh8Ff0jBGAxIQYmXgu8KSqsRy7iCNYQZUdseXTnkA/qPZ/UTrsOswRKLlz+Twjnu91z40yeHPeV7jmMOOrGefZBPjd7jC+FiPq55STjLzyMjHfBqMc2jcS3gRWLlpULUCCn/cDZ+8tXBs/Zl+dG8uYTKMM6Et+l8S3apvLLC1hB9IBZQ+4P+94uxPNWJf7/+Wn/O65f97VxnEWqgLAe2NMc9mdqtm87PPJZ/ekN1wk/hmnsOMDFwmaNbPHzY11paLGaZtWyDX9dfZJGe0hg=

/* OK */
declare function fn(x: HTMLDivElement): string;
declare function fn(x: HTMLElement): number;
declare function fn(x: unknown): unknown;

var myElem: HTMLDivElement;
var x = fn(myElem); // x: string, :)

s45zFDD7Lji6BLaQWUDwMN/1jTftzqsmVBkJfMVEceO+zEkpaqA+5JjlUvqexmgho9K9NHNlIfKF6On1QInd1wjFvqIz1r3RITQOy0IFII9WOowNals/N2UufQnRrJqBhp/mjcdp4ikN9S/eMnR5E5xijbVm8pfqb5YfwcQ79rvp/xlOzk9w/w+BrlqXImJhPmPxBH4vZfN7zPwJYWYTVCJxmmqV9BOcaTVSzePCEuKvbkOfbqL0/2dRGMAOAt926YaKnKAsX1rjbloVoQrb6n9bThKWqnNYeI4lD7mzViBY+hBpy16OVpiyZ+G2sWs2eZ5PC/XYKwDDbWQTFsbsrC8c2GBc/vbZdUVO/MjlMJEBkb03k5XpJTAYNyEpgY/rpBZr2njNgzVBkAZOxrVxsmP6hkylaMaGq5FOtXzJF9CTmFHh3769QUhs8KAco8TSeZ5i8YC24iXcbwoBqJ/5xFxLuSml6XTzF/hopPs7HVla9K7pXbj9K6h7IAeyjTY0jITb28StSICU2zeKSqzkOZIVgUTl306cJPQmT131mF/Gi9ye7KQJeWKKh6rGjB5xaSQ9UFYaVMDBZP2jKXSLfJsVr+w7Tw2OTUU9qLN1s7lGpkAO74B4oOd78m5qdYb5