I want to apply a definitionExpression to a feature layer after it's been created in my TypeScript project with this code.
const exp = 'OBJECTID = 1';
regionLayer.definitionExpression(exp);
but I am getting the error
Error TS2349 (TS) This expression is not callable.
Type 'String' has no call signatures
If I add the property when I create the feature layer, I don't get this error
const test = 'OBJECTID = 1';
const regionLayer = new FeatureLayer({
url: url,
definitionExpression: test,
outFields: ['*']
}); but I have the change the definitionExpression when the user makes certain choices.
What is causing this error?