4

I have a question about String.prototype.toLocaleLowerCase() ;

I want to use toLocaleLowerCase() with locale parameter like here

But I get this error.

But I get this error

lib.es5.d.ts

lib.es5.d.ts

Could you help me, please?

Package and System Info:

cli packages: (C:\Users\Ahmet\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.18.0
ionic (Ionic CLI) : 3.18.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.0.0-201710070411
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.7.1

System:

Node : v8.7.0
npm  : 5.5.1
OS   : Windows 10

1 Answer 1

4

The locale parameter is still in draft mode : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase

enter image description here

Hot fix:

Use a type assertion (beware):

('some string' as any).toLocaleLowerCase('tr');

Proper fix

Wait till the feature is standardized as it probably doesn't work across browsers right now.

1
  • Is this still in draft mode, link says all browsers support it but I still get the same error when I add locale parameter, even type definition says it takes an optional parameter but compile fails
    – mkb
    May 28, 2020 at 21:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.