But if I want to directly output the values, I will throw an error
console.log(block.child_page.title)
PS D:\Project\Github\notion-sdk-typescript-starter> npm start
> notion-sdk-project@1.0.0 start
> ts-node src/index.ts
D:\Project\Github\notion-sdk-typescript-starter\node_modules\ts-node\src\index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
src/index.ts:22:21 - error TS2339: Property 'child_page' does not exist on type 'GetBlockResponse'.
Property 'child_page' does not exist on type 'PartialBlockObjectResponse'.
22 console.log(block.child_page.title)
~~~~~~~~~~
at createTSError (D:\Project\Github\notion-sdk-typescript-starter\node_modules\ts-node\src\index.ts:859:12)
at reportTSError (D:\Project\Github\notion-sdk-typescript-starter\node_modules\ts-node\src\index.ts:863:19)
at getOutput (D:\Project\Github\notion-sdk-typescript-starter\node_modules\ts-node\src\index.ts:1077:36)
at Object.compile (D:\Project\Github\notion-sdk-typescript-starter\node_modules\ts-node\src\index.ts:1433:41)
at Module.m._compile (D:\Project\Github\notion-sdk-typescript-starter\node_modules\ts-node\src\index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Object.require.extensions.<computed> [as .ts] (D:\Project\Github\notion-sdk-typescript-starter\node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) {
diagnosticCodes: [ 2339 ]
}
PS D:\Project\Github\notion-sdk-typescript-starter>
Even if I try to convert it to JSON, it won't work
I am learning how to use notion API.
I have no problem running this, I can return a JSON object.
But if I want to directly output the values, I will throw an error
Even if I try to convert it to JSON, it won't work
I don't know what I should do.