Skip to content

Commit ca4d752

Browse files
committed
Removed twoslash as it broke vitepress build
1 parent 26c0d4d commit ca4d752

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@cap-js/cds-typer": "^0",
2121
"@cap-js/cds-types": "^0",
2222
"@sap/cds": "^9",
23-
"@shikijs/vitepress-twoslash": "^2.0.0",
23+
"@shikijs/vitepress-twoslash": "^3",
2424
"@types/adm-zip": ">=0.5.0",
2525
"@types/express": "^4.17.21",
2626
"@typescript-eslint/parser": "^8.0.0",

tools/cds-typer.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ If you are planning to use cds-typer in a TypeScript project, you should read th
2626
5. Saving any _.cds_ file of your model from VS Code triggers the type generation process.
2727
6. Model types now have to be imported to service implementation files by traditional imports of the generated files:
2828

29-
```js twoslash
29+
```js
3030
// @noErrors
3131
const cds = require('@sap/cds')
3232
const service = new cds.ApplicationService
@@ -38,7 +38,7 @@ service.before('CREATE', Books, ({ data }) => { /* data is of type any */})
3838
```
3939
<p/>
4040

41-
```js twoslash
41+
```js
4242
// @noErrors
4343
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
4444
const cds = require('@sap/cds')
@@ -69,7 +69,7 @@ The types emitted by the type generator are tightly integrated with the CDS API.
6969

7070
Most CQL constructs have an overloaded signature to support passing in generated types. Chained calls will offer code completion related to the type you pass in.
7171

72-
```js twoslash
72+
```js
7373
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
7474
const cds = require('@sap/cds')
7575
// ---cut---
@@ -99,7 +99,7 @@ Note that your entities will expose additional capabilities in the context of CQ
9999
### CRUD Handlers
100100
The CRUD handlers `before`, `on`, and `after` accept generated types:
101101

102-
```js twoslash
102+
```js
103103
// @noErrors
104104
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
105105
const cds = require('@sap/cds')
@@ -132,7 +132,7 @@ service.on('READ', Book, req => req.data.ID)
132132

133133
In the same manner, actions can be combined with `on`:
134134

135-
```js twoslash
135+
```js
136136
// @noErrors
137137
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
138138
const cds = require('@sap/cds')
@@ -154,7 +154,7 @@ You can remedy this by specifying the expected type with one of the following op
154154

155155
Using [JSDoc](https://jsdoc.app/) in JavaScript projects:
156156

157-
```js twoslash
157+
```js
158158
// @noErrors
159159
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
160160
const cds = require('@sap/cds')
@@ -173,7 +173,7 @@ function readBooksHandler (req) {
173173
<br>
174174
Using `import` in TypeScript projects:
175175

176-
```ts twoslash
176+
```ts
177177
// @noErrors
178178
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
179179
import cds from '@sap/cds'
@@ -197,7 +197,7 @@ CDS enums are supported by `cds-typer` and are represented during runtime as wel
197197

198198
<<< assets/incidents/db/schema.cds
199199

200-
```js twoslash
200+
```js
201201
// @paths: {"#cds-models/*": ["%typedModels:incidents:resolved%"]}
202202
const cds = require('@sap/cds')
203203
const service = new cds.ApplicationService
@@ -253,7 +253,7 @@ class Book {
253253

254254
In consequence, you will get called out by the type system when trying to chain property calls. You can overcome this in a variety of ways:
255255

256-
```ts twoslash
256+
```ts
257257
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
258258
import cds from '@sap/cds'
259259
// ---cut---
@@ -292,7 +292,7 @@ CDS file:
292292

293293
Generated classes:
294294

295-
```ts twoslash
295+
```ts
296296
// @paths: {"#cds-models/*": ["%typedModels:farm:resolved%"]}
297297
import { Mouse, Mice, Sheep, FlockOfSheep } from '#cds-models/farm'
298298
```
@@ -457,7 +457,7 @@ const { Books } = require('#cds-models/sap/capire/bookshop')
457457

458458
These imports will behave like [`cds.entities('sap.capire.bookshop')`](../node.js/cds-reflect#entities) during runtime, but offer you code completion and type hinting at design time:
459459

460-
```js twoslash
460+
```js
461461
// @noErrors
462462
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
463463
const cds = require('@sap/cds')
@@ -476,7 +476,7 @@ class CatalogService extends cds.ApplicationService { init(){
476476
477477
Similar to `cds.entities(…)`, you can't use static imports here. Instead, you need to use dynamic imports. However, there's an exception for [static top-level imports](#typer-top-level-imports).
478478
479-
```js twoslash
479+
```js
480480
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
481481
const cds = require('@sap/cds')
482482
// ---cut---
@@ -491,7 +491,7 @@ class CatalogService extends cds.ApplicationService { init(){
491491
492492
In TypeScript you can use [type-only imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) on top level if you just want the types for annotation purposes. The counterpart for the JavaScript example above that works during design time _and_ runtime is a [dynamic import expression](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-4.html#dynamic-import-expressions):
493493
494-
```ts twoslash
494+
```ts
495495
// @noErrors
496496
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
497497
import cds from '@sap/cds'
@@ -510,7 +510,7 @@ class CatalogService extends cds.ApplicationService { async init(){
510510
### Static Top-Level Imports <Since version="0.26.0" of="@cap-js/cds-typer" /> {#typer-top-level-imports}
511511
You can pass a new option, `useEntitiesProxy`, to `cds-typer`. This option allows you to statically import your entities at the top level, as you intuitively would. However, you can still only _use these entities_ in a context where the CDS runtime is fully booted, like in a service definition:
512512
513-
```ts twoslash
513+
```ts
514514
// @paths: {"#cds-models/*": ["%typedModels:bookshop:resolved%"]}
515515
import cds from '@sap/cds'
516516
// ---cut---

0 commit comments

Comments
 (0)