Why do some properties in ts use'.' Access will report not exist and ['property'] access properties will be OK?

typescript introduces echarts to use gradient LinearGradient

pass "." Cannot access LinearGradient

error report: Property "LinearGradient" does not exist on type" Graphic"
import * as echarts  from "echarts/lib/echarts";
 
new echarts.graphic.LinearGradient 

// Property "LinearGradient" does not exist on type "Graphic".

this allows you to use LinearGradient

color: new echarts.graphic["LinearGradient"]( // tslint:disable-line

where do I need to configure to use echarts.graphic.LinearGradient without reporting an error?

Why do some properties in ts use"." Access will report not exist
and ["property"] access properties will be OK?

May.08,2021
Menu