Skip to content
This repository was archived by the owner on Oct 6, 2021. It is now read-only.

Commit 4f3bfd1

Browse files
committed
TASK: Use synthetic default exports & Use rather than & Slightly update snippet
1 parent 44d10c6 commit 4f3bfd1

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ All notable changes to the "vscode-awesome-ts-react-redux-snippets" extension wi
33

44
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
55

6+
## [2.1.0] - 2019-03-15
7+
- Use synthetic default exports, e.g.:
8+
```ts
9+
import * as React from 'react';
10+
```
11+
to
12+
```ts
13+
import React from 'react';
14+
```
15+
- Use `type` rather than `interface` when applicable
16+
- Slightly update `test` snippet
17+
618
## [2.0.0] - 2019-03-01
719
- **breaking:** now using `@sandstormmedia/react-redux-ts-utils` instead of `@martin_hotell/rex-tils`
820
- removed `readonly` keywords in `interface` definitions

snippets/typescript.snippets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
"//",
1313
"// State",
1414
"//",
15-
"export interface ${1:StoreName}State {",
15+
"export type ${1:StoreName}State = Readonly<{",
1616
"\ttemplate?: string;",
17-
"}",
17+
"}>;",
1818
"\r",
1919
"const initialState: ${1:StoreName}State = {",
2020
"\ttemplate: undefined,",

snippets/typescriptreact.snippets.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"Component Skeleton": {
33
"prefix": "component",
44
"body": [
5-
"import * as React from 'react';",
5+
"import React from 'react';",
66
"import { PickDefaultProps } from '@sandstormmedia/react-redux-ts-utils';",
77
"\r",
88
"//",
99
"// Props",
1010
"//",
11-
"interface ${1:ComponentName}Props {",
11+
"type ${1:ComponentName}Props = Readonly<{",
1212
"\ttemplate: string;",
13-
"}",
13+
"}>;",
1414
"\r",
1515
"type DefaultProps = PickDefaultProps<${1:ComponentName}Props, 'template'>;",
1616
"\r",
@@ -21,9 +21,9 @@
2121
"//",
2222
"// State",
2323
"//",
24-
"interface ${1:ComponentName}State {",
24+
"type ${1:ComponentName}State = Readonly<{",
2525
"\tisCool: boolean;",
26-
"}",
26+
"}>;",
2727
"\r",
2828
"const initialState: ${1:ComponentName}State = {",
2929
"\tisCool: true,",
@@ -55,7 +55,7 @@
5555
"Container Skeleton": {
5656
"prefix": "container",
5757
"body": [
58-
"import * as React from 'react';",
58+
"import React from 'react';",
5959
"import { connect } from 'react-redux';",
6060
"\r",
6161
"import { actions, ApplicationState, selectors } from '../../Redux/Store';",
@@ -80,9 +80,9 @@
8080
"Storybook Story Skeleton": {
8181
"prefix": "story",
8282
"body": [
83-
"import { action } from '@storybook/addon-actions';",
83+
"import React from 'react';",
8484
"import { storiesOf } from '@storybook/react';",
85-
"import * as React from 'react';",
85+
"import { action } from '@storybook/addon-actions';",
8686
"\r",
8787
"import ${1:ComponentName} from '.';",
8888
"\r",
@@ -97,15 +97,17 @@
9797
"Component Test Skeleton": {
9898
"prefix": "test",
9999
"body": [
100-
"import * as React from 'react';",
101-
"import { render } from 'react-dom';",
102-
"import * as ReactTestRenderer from 'react-test-renderer';",
100+
"import React from 'react';",
101+
"import ReactDOM from 'react-dom';",
102+
"import ReactTestRenderer from 'react-test-renderer';",
103103
"\r",
104104
"import ${1:ComponentName} from '.';",
105105
"\r",
106106
"describe('${1:ComponentName} tests', () => {",
107107
"\tit('should render without crashing', () => {",
108-
"\t\trender(<${1:ComponentName} />, document.createElement('div'));",
108+
"\t\tconst div = document.createElement('div');",
109+
"\t\tReactDOM.render(<${1:ComponentName} />, div);",
110+
"\t\tReactDOM.unmountComponentAtNode(div);",
109111
"\t});",
110112
"\r",
111113
"\tit('should match snapshot', () => {",

0 commit comments

Comments
 (0)