Abbreviation and Hungarian (ARCH3011)
Ce contenu n’est pas encore disponible dans votre langue.
Key typescript.naming.no-hungarian-notation · Severity info · Category naming
Hungarian-notation type prefixes (strName, iCount, b_flag) and cryptic abbreviations add noise by duplicating information the type system already provides, hurting readability.
Incorrect
Section titled “Incorrect”function process(strName: string, iCount: number, b_active: boolean) { const arrItems: string[] = []; const objCfg = loadConfig(); return { strName, iCount, b_active, arrItems, objCfg };}Correct
Section titled “Correct”function process(name: string, count: number, active: boolean) { const items: string[] = []; const config = loadConfig(); return { name, count, active, items, config };}Drop the type prefix and cryptic abbreviations; rename the identifier to a plain, meaningful word.