Skip to content

Commit 0157f97

Browse files
authored
[Cleanup] Remove allowImportFromTsExtensions in tsconfig.json (#105)
1 parent a4ce6e2 commit 0157f97

File tree

9 files changed

+16
-11
lines changed

9 files changed

+16
-11
lines changed

scripts/create-cts-files.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ async function createCtsFiles() {
77

88
for (const file of definitionFiles) {
99
const content = readFileSync(`./dist/cjs/types/${file}`, 'utf-8');
10-
const updatedContent = content.replaceAll('.ts', '.d.cts');
10+
const updatedContent = content
11+
.replaceAll('.ts', '.d.cts')
12+
.replaceAll('.js', '.d.cts')
13+
.replaceAll('import {', 'import type {');
1114

1215
writeFileSync(`./dist/cjs/types/${file}`, updatedContent, 'utf-8');
1316

scripts/create-mts-files.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ async function createMtsFiles() {
77

88
for (const file of definitionFiles) {
99
const content = readFileSync(`./dist/esm/types/${file}`, 'utf-8');
10-
const updatedContent = content.replaceAll('.ts', '.d.mts');
10+
const updatedContent = content
11+
.replaceAll('.ts', '.d.mts')
12+
.replaceAll('.js', '.d.mts')
13+
.replaceAll('import {', 'import type {');
1114

1215
writeFileSync(`./dist/esm/types/${file}`, updatedContent, 'utf-8');
1316

src/__tests__/copier.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import {
1212
copyObjectStrict,
1313
copyPrimitiveWrapper,
1414
copySetStrict,
15-
} from '../copier.ts';
16-
import { createDefaultCache } from '../options.ts';
15+
} from '../copier.js';
16+
import { createDefaultCache } from '../options.js';
1717

1818
describe('copyArrayStrict', () => {
1919
it('will copy both indices and explicit properties', () => {

src/__tests__/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from 'vitest';
22
import React from 'react';
33

4-
import { copy, copyStrict } from '../index.ts';
4+
import { copy, copyStrict } from '../index.js';
55

66
interface PlainObject {
77
[key: string]: any;

src/__tests__/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from 'vitest';
2-
import { getCleanClone } from '../utils.ts';
2+
import { getCleanClone } from '../utils.js';
33

44
interface PlainObject {
55
[key: string]: any;

src/copier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getCleanClone } from './utils.ts';
1+
import { getCleanClone } from './utils.js';
22

33
import type { Cache } from './utils.ts';
44

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getOptions } from './options.ts';
2-
import { getTag } from './utils.ts';
1+
import { getOptions } from './options.js';
2+
import { getTag } from './utils.js';
33

44
import type { State } from './copier.ts';
55
import type { CreateCopierOptions } from './options.ts';

src/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
copySelf,
1616
copySetLoose,
1717
copySetStrict,
18-
} from './copier.ts';
18+
} from './copier.js';
1919
import type { Cache } from './utils.ts';
2020

2121
export interface CopierMethods {

tsconfig/base.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"compilerOptions": {
3-
"allowImportingTsExtensions": true,
43
"baseUrl": "src",
54
"esModuleInterop": true,
65
"jsx": "react",

0 commit comments

Comments
 (0)