Skip to content

Commit ee5cc2b

Browse files
committed
Update ts fenced code blocs to typescript
- references SharePoint#5926
1 parent 51f90cb commit ee5cc2b

12 files changed

+55
-55
lines changed

docs/spfx/connect-to-anonymous-apis.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ When building SharePoint Framework solutions, you might want to consume public A
1717

1818
The easiest way, to connect to anonymous APIs in your SharePoint Framework solutions, is by using the HttpClient provided as a part of the SharePoint Framework. For example, to get dummy information from the Typicode service, you would execute:
1919

20-
```ts
20+
```typescript
2121
this.context.httpClient
2222
.get('https://jsonplaceholder.typicode.com/todos/1', HttpClient.configurations.v1)
2323
.then((res: HttpClientResponse): Promise<any> => {
@@ -30,7 +30,7 @@ this.context.httpClient
3030

3131
Similarly to the SPHttpClient you use for connecting to SharePoint APIs, the HttpClient offers you similar capabilities for performing the most common web requests. If necessary, you can use its options, to configure requests. For example, to specify request headers, you would use the following code:
3232

33-
```ts
33+
```typescript
3434
this.context.httpClient
3535
.get('https://jsonplaceholder.typicode.com/todos/1', HttpClient.configurations.v1,
3636
{

docs/spfx/connect-to-sharepoint.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In your SharePoint Framework solutions, you will likely want to interact with da
1414

1515
SharePoint Framework offers the SPHttpClient that you can use to connect to SharePoint REST APIs. A ready-to-use instance of the SPHttpClient is available on the web part/extension context and you can use it to perform all kinds of web request. Following code snippet shows how you would use the SPHttpClient to retrieve the title of the current site:
1616

17-
```ts
17+
```typescript
1818
this.context.spHttpClient
1919
.get(`${this.context.pageContext.web.absoluteUrl}/_api/web?$select=Title`, SPHttpClient.configurations.v1)
2020
.then((res: SPHttpClientResponse): Promise<{ Title: string; }> => {
@@ -27,7 +27,7 @@ this.context.spHttpClient
2727

2828
The SPHttpClient offers basic functionality for performing the most common web requests. It allows you also, to configure your request by for example specifying request headers. For example, if you wanted to issue a web request without retrieving metadata, you'd use the following code:
2929

30-
```ts
30+
```typescript
3131
this.context.spHttpClient
3232
.get(`${this.context.pageContext.web.absoluteUrl}/_api/web?$select=Title`,
3333
SPHttpClient.configurations.v1,
@@ -52,7 +52,7 @@ When using the SPHttpClient there are a few things that you should take into acc
5252

5353
By default, the SPHttpClient uses OData v4 specification, which requires using `odata.metadata` instead of just `odata` to control the response metadata. If you use the `odata` directive in OData v4 mode, you will get an error, like: _The HTTP header ACCEPT is missing or its value is invalid._. It is possible to set the SPHttpClient to OData v3.0 mode, by setting the `odata-version` request header to empty value:
5454

55-
```ts
55+
```typescript
5656
this.context.spHttpClient
5757
.get(`${this.context.pageContext.web.absoluteUrl}/_api/web?$select=Title`,
5858
SPHttpClient.configurations.v1,
@@ -86,7 +86,7 @@ The SPHttpClient offers basic support for communicating with the SharePoint REST
8686

8787
[PnPjs](https://pnp.github.io/pnpjs/) is an open-source JavaScript library for communicating with SharePoint and Office 365. It exposes a fluent API that allows you to easily consume SharePoint and Office 365 REST APIs in a type-safe way. To retrieve a the title of the current site using PnPjs, you would execute the following code:
8888

89-
```ts
89+
```typescript
9090
sp.web
9191
.select('Title')
9292
.get<{Title: string;}>()

docs/spfx/dynamic-data.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Dynamic data in the SharePoint Framework is based on the source-notification mod
2121

2222
Every dynamic data source implements the `IDynamicDataCallables` interface. Following, is an example of a web part that displays a list of upcoming events. For each event, it includes some information such as its name, description, and ___location. The events web part exposes information about the selected event to other components on the page in two ways: the complete event information and the ___location address.
2323

24-
```ts
24+
```typescript
2525
import {
2626
IDynamicDataPropertyDefinition,
2727
IDynamicDataCallables
@@ -157,7 +157,7 @@ In the example code, the web part displays upcoming events in a list. Each time,
157157
158158
Web parts can consume data exposed by dynamic data sources present on the page. Following is the code of a web part showing on a map the ___location of the event selected in the events list web part showed previously.
159159
160-
```ts
160+
```typescript
161161
import { DynamicProperty } from '@microsoft/sp-component-base';
162162
import {
163163
DynamicDataSharedDepth,
@@ -329,7 +329,7 @@ SharePoint Framework offers standard UI for connecting web parts to dynamic data
329329

330330
Each web part property, for which the data can be retrieved from a dynamic data source, should be defined as `DynamicProperty<T>` where the `T` type denotes the type of data stored in the property, for example:
331331

332-
```ts
332+
```typescript
333333
/**
334334
* Map web part properties
335335
*/
@@ -349,7 +349,7 @@ In this example, the address is a string, but other types of data such as boolea
349349

350350
For each dynamic property, you have to specify the type of data it holds. This is necessary, so that the instance of the web part added to a page can be properly serialized. For each dynamic web part property, in the `propertiesMetadata` getter, specify the `dynamicPropertyType` value:
351351

352-
```ts
352+
```typescript
353353
protected get propertiesMetadata(): IWebPartPropertiesMetadata {
354354
return {
355355
// Specify the web part properties data type to allow the address
@@ -377,7 +377,7 @@ To allow users to connect web parts to dynamic data sources available on the pag
377377
378378
In its simplest form, the UI could be defined as follows:
379379

380-
```ts
380+
```typescript
381381
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
382382
return {
383383
pages: [
@@ -406,7 +406,7 @@ For each set of dynamic properties, add a new group using the `PropertyPaneDynam
406406

407407
If your dynamic data field set consists of multiple dynamic properties, you can specify how the connection data is shared using the `sharedConfiguration.depth` property:
408408

409-
```ts
409+
```typescript
410410
groupFields: [
411411
PropertyPaneDynamicFieldSet({
412412
label: 'Address',
@@ -433,7 +433,7 @@ When building web parts, you can allow users to connect web parts to other compo
433433

434434
To allow users to choose if they want to load data from a dynamic property or enter the value themselves in the web part properties, you can define the web part properties group as a `IPropertyPaneConditionalGroup` group.
435435

436-
```ts
436+
```typescript
437437
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
438438
return {
439439
pages: [

docs/spfx/office-ui-fabric-integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ Solutions build with *no JavaScript framework* option.
300300
1. Add `@uifabric/styling` package to your `package.json`
301301
1. Make code changes similar to below code, to get the required icon into your code:
302302
303-
```ts
303+
```typescript
304304
import { getIconClassName } from '@uifabric/styling';
305305

306306
return `<i class="${getIconClassName('Mail')}" />`;
@@ -311,7 +311,7 @@ Solutions build with *React* option or by using *React* in general.
311311
1. Add `office-ui-fabric-react` package to your `package.json`, if not already added.
312312
2. Make code changes similar to below code, to get the required icon into your code:
313313
314-
```ts
314+
```typescript
315315
import { Icon } from 'office-ui-fabric-react/lib/Icon';
316316

317317
<Icon iconName='Mail' />

docs/spfx/subscribe-to-list-notifications.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ To subscribe to changes to files stored in a SharePoint Document Library, create
2424

2525
Following, is an example of a list subscription for a Document Library located in the current site:
2626

27-
```ts
27+
```typescript
2828
import { ListSubscriptionFactory, IListSubscription } from '@microsoft/sp-list-subscription';
2929
import { Guid } from '@microsoft/sp-core-library';
3030

@@ -60,7 +60,7 @@ Depending on your solution, you might need to provide additional configuration w
6060

6161
If you use SharePoint in a multi-geography tenancy, you need to provide the ___domain where the particular site collection lives in. You can do it, using the `___domain` property, for example:
6262

63-
```ts
63+
```typescript
6464
this._listSubscriptionFactory.createSubscription({
6565
___domain: this.properties.siteDomain,
6666
siteId: Guid.parse(this.properties.siteId),
@@ -78,7 +78,7 @@ In some cases, you might want to get notified when the component that you're bui
7878

7979
The list subscription API, exposes two additional callbacks which you can implement to respond to the subscription status. The following code illustrates the case, where the component will be notified when the subscription has been established and when it was disconnected.
8080

81-
```ts
81+
```typescript
8282
private createListSubscription(): void {
8383
this._listSubscriptionFactory.createSubscription({
8484
___domain: this.properties.siteDomain,

docs/spfx/toolchain/implement-ci-cd-with-azure-devops.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ You also need to configure your project to leverage jest when typing commands. T
115115

116116
To write your first unit test, create a new file `src/webparts/webPartName/tests/webPartName.spec.ts` and add the following content:
117117

118-
```TS
118+
```typescript
119119
import 'jest'
120120

121121
describe("webPartName", () => {

docs/spfx/use-aadhttpclient-enterpriseapi-multitenant.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,13 @@ In the code editor, open the **src\webparts\orders\OrdersWebPart.ts** file.
352352

353353
In the top section of the file, reference the **AadHttpClient** and **HttpClientResponse** classes, by adding the following code snippet:
354354

355-
```ts
355+
```typescript
356356
import { AadHttpClient, HttpClientResponse } from '@microsoft/sp-http';
357357
```
358358

359359
To the **OrdersWebPart** class, add a new class variable named `ordersClient`:
360360

361-
```ts
361+
```typescript
362362
export default class OrdersWebPart extends BaseClientSideWebPart<IOrdersWebPartProps> {
363363
private ordersClient: AadHttpClient;
364364

@@ -368,7 +368,7 @@ export default class OrdersWebPart extends BaseClientSideWebPart<IOrdersWebPartP
368368

369369
Next, in the **OrdersWebPart** class, override the **onInit** method to create an instance of the AadHttpClient:
370370

371-
```ts
371+
```typescript
372372
export default class OrdersWebPart extends BaseClientSideWebPart<IOrdersWebPartProps> {
373373
private ordersClient: AadHttpClient;
374374

@@ -391,7 +391,7 @@ The URI passed into the `getClient()` method is the Application ID URI of the Az
391391

392392
Finally, extend the **render** method to load and display orders retrieved from the enterprise API:
393393

394-
```ts
394+
```typescript
395395
export default class OrdersWebPart extends BaseClientSideWebPart<IOrdersWebPartProps> {
396396
private ordersClient: AadHttpClient;
397397

docs/spfx/use-aadhttpclient-enterpriseapi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,13 @@ In the code editor, open the **src\webparts\orders\OrdersWebPart.ts** file:
290290

291291
In the top section of the file, reference the **AadHttpClient** and **HttpClientResponse** classes, by adding the following code snippet:
292292

293-
```ts
293+
```typescript
294294
import { AadHttpClient, HttpClientResponse } from '@microsoft/sp-http';
295295
```
296296

297297
To the **OrdersWebPart** class, add a new class variable named `ordersClient`:
298298

299-
```ts
299+
```typescript
300300
export default class OrdersWebPart extends BaseClientSideWebPart<IOrdersWebPartProps> {
301301
private ordersClient: AadHttpClient;
302302

@@ -306,7 +306,7 @@ export default class OrdersWebPart extends BaseClientSideWebPart<IOrdersWebPartP
306306

307307
Next, in the **OrdersWebPart** class, override the **onInit** method to create an instance of the AadHttpClient:
308308

309-
```ts
309+
```typescript
310310
export default class OrdersWebPart extends BaseClientSideWebPart<IOrdersWebPartProps> {
311311
private ordersClient: AadHttpClient;
312312

@@ -329,7 +329,7 @@ The GUID passed as the second parameter of the **AadHttpClient** constructor, is
329329

330330
Finally, extend the **render** method to load and display orders retrieved from the enterprise API:
331331

332-
```ts
332+
```typescript
333333
export default class OrdersWebPart extends BaseClientSideWebPart<IOrdersWebPartProps> {
334334
private ordersClient: AadHttpClient;
335335

docs/spfx/use-developer-dashboard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ When building SharePoint Framework components, you can use the built-in logger t
3232

3333
Following, is how you would log a verbose message to the SharePoint Framework developer dashboard:
3434

35-
```ts
35+
```typescript
3636
// [...] shortened for brevity
3737
import { Log } from '@microsoft/sp-core-library';
3838

docs/spfx/web-parts/basics/working-with-requestdigest.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The benefit of using the DigestCache service over manually obtaining a valid req
5353

5454
1. Import the **DigestCache** and **IDigestCache** types from the **\@microsoft/sp-http** package:
5555

56-
```ts
56+
```typescript
5757
// ...
5858
import { IDigestCache, DigestCache } from '@microsoft/sp-http';
5959

@@ -64,7 +64,7 @@ The benefit of using the DigestCache service over manually obtaining a valid req
6464

6565
1. Whenever you need a valid request digest token, retrieve a reference to the DigestCache service, and call its **fetchDigest** method:
6666

67-
```ts
67+
```typescript
6868
// ...
6969
import { IDigestCache, DigestCache } from '@microsoft/sp-http';
7070

0 commit comments

Comments
 (0)