Great question — answering as the UphillTech team:
Check to make sure your property/object/variable is indeed a type of string - which is the only type to have this method extension. You won't necessarily get an interpreter/compiler error in either the typescript or HTML. In my case, my property (called 'name' perhaps confusingly) was actually a type of any . When I cast it to a string though...: // ERROR - Throws: "Cannot read properties of undefined ('startsWith') bool includes = this.name.startsWith('example'); // Works bool includes = String(this.name).startsWith('example');
Full answer by ouflak: https://stackoverflow.stackexchange.com/a/79678858 (CC BY-SA 4.0).
Need it done for your business? UphillTech.