-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add nodeModulesInputFilePaths
- Loading branch information
Showing
8 changed files
with
102 additions
and
18 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
fixtures/components/third-party-import-types/button/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import * as React from 'react'; | ||
|
||
import { ButtonProps } from './interfaces'; | ||
|
||
export { ButtonProps }; | ||
|
||
/** | ||
* Component-level description | ||
*/ | ||
export default function Button({ iconName }: ButtonProps) { | ||
return <div className={iconName}>{iconName}</div>; | ||
} |
10 changes: 10 additions & 0 deletions
10
fixtures/components/third-party-import-types/button/interfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { IconProps } from '../node_modules/icon'; | ||
|
||
export interface ButtonProps { | ||
/** | ||
* This is icon name | ||
*/ | ||
iconName: IconProps.Name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "button" | ||
}, | ||
"include": ["button"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { buildProject } from './test-helpers'; | ||
import { ComponentDefinition } from '../../src'; | ||
import process from 'node:process'; | ||
const cwd = process.cwd(); | ||
|
||
test('should resolve object type to string', () => { | ||
const resultBefore = buildProject('third-party-import-types'); | ||
const buttonBefore: ComponentDefinition | undefined = resultBefore.find(component => component.name === 'Button'); | ||
|
||
expect(buttonBefore?.properties).toEqual([ | ||
{ | ||
name: 'iconName', | ||
type: 'IconProps.Name', | ||
inlineType: undefined, | ||
optional: false, | ||
description: 'This is icon name', | ||
defaultValue: undefined, | ||
visualRefreshTag: undefined, | ||
deprecatedTag: undefined, | ||
i18nTag: undefined, | ||
analyticsTag: undefined, | ||
}, | ||
]); | ||
|
||
const resultAfter = buildProject('third-party-import-types', [ | ||
`${cwd}/fixtures/components/third-party-import-types/node_modules/icon/interfaces.d.ts`, | ||
]); | ||
const buttonAfter: ComponentDefinition | undefined = resultAfter.find(component => component.name === 'Button'); | ||
|
||
expect(buttonAfter?.properties).toEqual([ | ||
{ | ||
name: 'iconName', | ||
type: 'string', | ||
inlineType: { name: 'IconProps.Name', type: 'union', values: ['icon1', 'icon2', 'icon3'] }, | ||
optional: false, | ||
description: 'This is icon name', | ||
defaultValue: undefined, | ||
visualRefreshTag: undefined, | ||
deprecatedTag: undefined, | ||
i18nTag: undefined, | ||
analyticsTag: undefined, | ||
}, | ||
]); | ||
}); |