ua-parser-js icon indicating copy to clipboard operation
ua-parser-js copied to clipboard

Typescript types for browser name

Open DerZyklop opened this issue 3 years ago • 0 comments
trafficstars

This project has an entry in DefinitelyTyped. I suggested to them, that it would be nice to have more fine-grained types for the browser name. E.g. to have code completion when working with the browser name.

I wrote this type:

export type CommonBrowserNames = 'Amaya' | 'Android Browser' | 'Arora' | 'Avant' | 'Baidu' | 'Blazer' | 'Bolt' | 'Camino' | 'Chimera' | 'Chrome' | 'Chromium' | 'Comodo Dragon' | 'Conkeror' | 'Dillo' | 'Dolphin' | 'Doris' | 'Edge' | 'Epiphany' | 'Fennec' | 'Firebird' | 'Firefox' | 'Flock' | 'GoBrowser' | 'iCab' | 'ICE Browser' | 'IceApe' | 'IceCat' | 'IceDragon' | 'Iceweasel' | 'IE' | 'IE Mobile' | 'Iron' | 'Jasmine' | 'K-Meleon' | 'Konqueror' | 'Kindle' | 'Links' | 'Lunascape' | 'Lynx' | 'Maemo' | 'Maxthon' | 'Midori' | 'Minimo' | 'MIUI Browser' | 'Safari' | 'Mobile Safari' | 'Mosaic' | 'Mozilla' | 'Netfront' | 'Netscape' | 'NetSurf' | 'Nokia' | 'OmniWeb' | 'Opera Mini' | 'Opera Mobi' | 'Opera Tablet' | 'Phoenix' | 'Polaris' | 'QQBrowser' | 'RockMelt' | 'Silk' | 'Skyfire' | 'SeaMonkey' | 'SlimBrowser' | 'Swiftfox' | 'Tizen' | 'UCBrowser' | 'Vivaldi' | 'w3m' | 'Yandex';

Problem is: Someone would have to maintain the list of possibly returned types. It seems like this repo here is the better place to maintain the list of possible returned browser names. So this is the reason why I started this tread. Just in case you are interested in typescript types, too.

Some discussion happened here: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57497

DerZyklop avatar Dec 15 '21 10:12 DerZyklop