tradingview / charting-library-examples

Examples of Charting Library integrations with other libraries, frameworks and data transports
MIT License
1.44k stars 768 forks source link

error with angular (8.3.24) #161

Open marketdevsoft opened 4 years ago

marketdevsoft commented 4 years ago

Hi, i'm new and i try to install charting_library into angular (8.3.24), following this step: https://github.com/tradingview/charting-library-examples/blob/master/angular5/README.md. But when i run ng serve it fails with those errors: ERROR in src/assets/datafeeds/udf/src/symbols-storage.ts:76:3 - error TS2322: Type 'string | number | boolean | string[]' is not assignable to type 'ExchangeDataResponseSymbolData[Field]'. Type 'string' is not assignable to type 'ExchangeDataResponseSymbolData[Field]'. Type 'string' is not assignable to type 'never'.

76 return value[arrayIndex];


src/assets/datafeeds/udf/src/udf-compatible-datafeed-base.ts:243:74 - error TS2339: Property 'errmsg' does not exist on 
type 'UdfErrorResponse | UdfSearchSymbolsResponse'.
  Property 'errmsg' does not exist on type 'UdfSearchSymbolsResponse'.

Can somebody help me ?

Best Regards
timocov commented 4 years ago

What version of the TypeScript compiler you have?

maurodelazeri commented 4 years ago

running in the same problem, I took the example, yarn;yarn start and I get this...

should I use a specific version ?

ts-loader: Using typescript@3.8.3 and /home/mauro/Downloads/charting-library-examples/react-typescript/tsconfig.json
(76,3): Type 'string | number | boolean | string[]' is not assignable to type 'ExchangeDataResponseSymbolData[Field]'.
  Type 'string' is not assignable to type 'ExchangeDataResponseSymbolData[Field]'.
    Type 'string' is not assignable to type 'never'.

https://github.com/tradingview/charting_library/blob/master/datafeeds/udf/src/symbols-storage.ts#L76

maurodelazeri commented 4 years ago

I see https://github.com/tradingview/charting_library/issues/4457

maurodelazeri commented 4 years ago

is this unstable version available ?

timocov commented 4 years ago

We can guarantee success compilation of UDF datafeed only for TypeScript version we provided that package. We update that version as soon we update our project, but you can easily fix it for yourself because UDF datafeed provided with source code and basically should be in your repo (as soon it's just example of datafeed).

maurodelazeri commented 4 years ago

@timocov I got this, just need to force "typescript": "3.3.1" to match with the UDF

tusharquantsapp commented 4 years ago

@marketdevsoft add - 'as ExchangeDataResponseSymbolData' to the return statement in src/assets/datafeeds/udf/src/symbols-storage.ts:76:3