how to dynamic set the space num of indent num

I have a typescript syntax codemirror editor, and I want to provider an option to user to adjust the space num of indent for user, how can I do this

I added indentUnit.of(" ") to codemirror extensions params, but it’s not working

See the configuration example.